How to use the @azure/storage-blob.uploadFileToBlockBlob function in @azure/storage-blob

To help you get started, we’ve selected a few @azure/storage-blob examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github serverless / serverless-azure-functions / src / services / azureBlobStorageService.ts View on Github external
public async uploadFile(path: string, containerName: string, blobName?: string) {
    Guard.empty(path, "path");
    Guard.empty(containerName, "containerName");
    this.checkInitialization();

    // Use specified blob name or replace `/` in path with `-`
    const name = blobName || path.replace(/^.*[\\\/]/, "-");
    this.log(`Uploading file at '${path}' to container '${containerName}' with name '${name}'`)
    await uploadFileToBlockBlob(Aborter.none, path, this.getBlockBlobURL(containerName, name));
    this.log("Finished uploading blob");
  };
github Azure-Samples / azure-storage-js-v10-quickstart / v10 / index.js View on Github external
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);
}