Skip to content

Commit

Permalink
create import map if not present in azure storage (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungurlakachakcak authored May 7, 2021
1 parent c149d38 commit f662d3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/io-methods/azure.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
} = require("@azure/storage-blob");

const { getCacheControl } = require("../cache-control");
const { getEmptyManifest } = require("../modify");

async function createBlobService(target) {
const connectionString =
Expand Down Expand Up @@ -47,6 +48,11 @@ exports.readManifest = async function (target) {
const blobService = await createBlobService(target);
const containerClient = blobService.getContainerClient(target.azureContainer);
const blobClient = containerClient.getBlobClient(target.azureBlob);
const blobExists = await blobClient.exists(target.azureBlob);

if (!blobExists) {
await exports.writeManifest(target, JSON.stringify(getEmptyManifest()));
}

const downloadBlockBlobResponse = await blobClient.download();
const response = await streamToString(
Expand Down

0 comments on commit f662d3d

Please sign in to comment.