Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function uploadLocalFile(aborter, containerURL, filePath) {
filePath = path.resolve(filePath);
const fileName = path.basename(filePath);
const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, fileName);
return await uploadFileToBlockBlob(aborter, filePath, blockBlobURL);
}
private getBlockBlobURL(containerName: string, blobName: string): BlockBlobURL {
Guard.empty(containerName, "containerName");
Guard.empty(blobName, "blobName");
this.checkInitialization();
return BlockBlobURL.fromContainerURL(
this.getContainerURL(containerName),
blobName,
);
}
private getBlockBlobURL(blobName: string): BlockBlobURL {
const containerURL = this.getContainerURL();
return BlockBlobURL.fromContainerURL(
containerURL,
blobName,
);
}
[componentVersion]: async () => {
const blobUrl = BlockBlobURL.fromContainerURL(this.container, current);
return JSON.parse(await this.downloadBlobAsString(blobUrl)).peerDependencies;
}
}
getCode: async () => {
const codeUrl = BlockBlobURL.fromContainerURL(this.container, `${basePath}/${main}`);
return await this.downloadBlobAsString(codeUrl);
}
};
async function uploadStream(aborter, containerURL, filePath) {
filePath = path.resolve(filePath);
const fileName = path.basename(filePath).replace('.md', '-stream.md');
const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, fileName);
const stream = fs.createReadStream(filePath, {
highWaterMark: FOUR_MEGABYTES,
});
const uploadOptions = {
bufferSize: FOUR_MEGABYTES,
maxBuffers: 5,
};
return await uploadStreamToBlockBlob(
aborter,
stream,
blockBlobURL,
uploadOptions.bufferSize,
uploadOptions.maxBuffers);