How to use the @azure/storage-blob.Aborter.none 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 HomecareHomebase / azure-bake / ingredient / ingredient-storage / src / plugin.ts View on Github external
private async ConfigureDiagnosticSettings(params: any, util: any) {
        let accountName: string;
        let accountKey: string;

        //Get blob storage properties
        accountName = params["storageAccountName"].value;
        const storageUtils = new StorageUtils(this._ctx);
        accountKey = await storageUtils.get_primary_key(accountName, await util.resource_group())
        const credentials = new SharedKeyCredential(accountName, accountKey);
        const pipeline = StorageURL.newPipeline(credentials, {
            // Enable logger when debugging
            // logger: new ConsoleHttpPipelineLogger(HttpPipelineLogLevel.INFO)
        });
        const blobPrimaryURL = `https://${accountName}.blob.core.windows.net/`;
        var serviceURL = new ServiceURL(blobPrimaryURL, pipeline)
        const serviceProperties = await serviceURL.getProperties(Aborter.none);

        //Get Bake variables for diagnostic settings.  Default to "true" (enabled) and 10 days data retention.
        let blobDiagnosticHourlyMetricsEnabled: string = await util.variable("blobDiagnosticHourlyMetricsEnabled") || "true"
        let blobDiagnosticHourlyMetricsRetentionDays = await util.variable("blobDiagnosticHourlyMetricsRetentionDays") || 10
        let blobDiagnosticMinuteMetricsEnabled: string = await util.variable("blobDiagnosticMinuteMetricsEnabled") || "true"
        let blobDiagnosticMinuteMetricsRetentionDays = await util.variable("blobDiagnosticMinuteMetricsRetentionDays") || 10
        let blobDiagnosticLoggingEnabled: string = await util.variable("blobDiagnosticLoggingEnabled") || "true"
        let blobDiagnosticLoggingRetentionDays = await util.variable("blobDiagnosticLoggingRetentionDays") || 10

        //Workaround due to issues using boolean data type for Bake variables
        var boolBlobDiagnosticHourlyMetricsEnabled: boolean = (blobDiagnosticHourlyMetricsEnabled == "true") ? true : false;
        var boolBlobDiagnosticMinuteMetricsEnabled: boolean = (blobDiagnosticMinuteMetricsEnabled == "true") ? true : false;
        var boolBlobDiagnosticLoggingEnabled: boolean = (blobDiagnosticLoggingEnabled == "true") ? true : false;

        //Debug logging of Bake variables
        this._logger.debug("blobDiagnosticHourlyMetricsEnabled:" + boolBlobDiagnosticHourlyMetricsEnabled)
github Azure-Samples / azure-storage-js-v10-quickstart / v10 / index.js View on Github external
async function showBlobNames(aborter, containerURL) {
    let marker = undefined;

    do {
        const listBlobsResponse = await containerURL.listBlobFlatSegment(Aborter.none, marker);
        marker = listBlobsResponse.nextMarker;
        for (const blob of listBlobsResponse.segment.blobItems) {
            console.log(` - ${ blob.name }`);
        }
    } while (marker);
}
github Budibase / budibase / packages / datastores / datastores / azure-blob.js View on Github external
export const loadFile = ({containerUrl}) => async key => {
    const blobURL = BlobURL.fromContainerURL(
        containerUrl, key);
    
    const downloadBlockBlobResponse = 
        await blobURL.download(Aborter.none, 0);
    
    return downloadBlockBlobResponse
            .readableStreamBody
            .read(content.length)
            .toString();
};
github microsoft / VoTT / src / providers / storage / azureBlobStorage.ts View on Github external
public async writeText(blobName: string, content: string | Buffer) {
        const blockBlobURL = this.getBlockBlobURL(blobName);
        await blockBlobURL.upload(
            Aborter.none,
            content,
            content.length,
        );
    }
github Budibase / budibase / packages / datastores / datastores / azure-blob.js View on Github external
export const createFile = ({containerUrl}) => async (key, content) => {
    const blobURL = BlobURL.fromContainerURL(containerURL, key);
    const blockBlobURL = BlockBlobURL.fromBlobURL(blobURL);
    await blockBlobURL.upload(
        Aborter.none,
        content,
        content.length
    );
};
github serverless / multicloud / azure / src / services / azureBlobStorage.ts View on Github external
public async read(opts: ReadBlobOptions): Promise {
    const containerURL = ContainerURL.fromServiceURL(this.service, opts.container);
    const blobURL = BlobURL.fromContainerURL(containerURL, opts.path);

    const stream = await blobURL.download(Aborter.none, 0)
    return stream.readableStreamBody
  }
}
github serverless / serverless-azure-functions / src / services / azureBlobStorageService.ts View on Github external
public async listContainers() {
    this.checkInitialization();

    const result: string[] = [];
    let marker;
    do {
      const listContainersResponse = await this.getServiceURL().listContainersSegment(
        Aborter.none,
        marker,
      );
      marker = listContainersResponse.nextMarker;
      for (const container of listContainersResponse.containerItems) {
        result.push(container.name);
      }
    } while (marker);

    return result;
  }
github HomecareHomebase / azure-bake / ingredient / ingredient-storage / src / plugin.ts View on Github external
read: boolBlobDiagnosticLoggingEnabled,
            retentionPolicy: {
                days: blobDiagnosticLoggingRetentionDays,
                enabled: true
            },
            version: "2.0",
            write: boolBlobDiagnosticLoggingEnabled
        };
        
        //Workaround for bug in Azure Javascript SDK.  https://github.com/Azure/azure-sdk-for-js/issues/2909
        if (!serviceProperties.cors) {
            serviceProperties.cors = undefined;
        }

        //Post blob service properties back to Azure
        await serviceURL.setProperties(Aborter.none, serviceProperties);
    }
}