How to use the azure-storage.BlobService function in azure-storage

To help you get started, we’ve selected a few azure-storage 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 pulumi / pulumi-cloud / azure / bucket.ts View on Github external
this.put = async (key, contents) => {
            const service = new azStorage.BlobService(storageAccount.name.get());
            const readableStream = new ReadableStream(contents);

            await new Promise((resolve, reject) => {
                service.createBlockBlobFromStream(container.name.get(), key, readableStream, contents.length, err => {
                    if (err) {
                        return reject(err);
                    }

                    resolve();
                });
            });
        };
github pulumi / pulumi-cloud / azure / bucket.ts View on Github external
this.delete = async (key) => {
            const service = new azStorage.BlobService(storageAccount.name.get());
            await new Promise((resolve, reject) => {
                service.deleteBlob(container.name.get(), key, (err: Error) => {
                    if (err) {
                        return reject(err);
                    }

                    resolve();
                });
            });
        };
github microsoft / appcenter-cli / src / commands / crashes / lib / azure-blob-upload-helper.ts View on Github external
private getBlobService(urlObject: Url.Url): AzureStorage.BlobService {
    const blobEndpoint = Url.format({
      protocol: urlObject.protocol,
      host: urlObject.host
    });
    const sharedAccessSignature = urlObject.query as string;

    const connectionString = "BlobEndpoint=" + blobEndpoint + ";" + "SharedAccessSignature=" + sharedAccessSignature;

    return new AzureStorage.BlobService(connectionString);
  }
github pulumi / pulumi-cloud / azure / bucket.ts View on Github external
this.get = async (key) => {
            const writableStream = new streamBuffers.WritableStreamBuffer();

            const service = new azStorage.BlobService(storageAccount.name.get());
            await new Promise((resolve, reject) => {
                service.getBlobToStream(container.name.get(), key, writableStream, err => {
                    if (err) {
                        return reject(err);
                    }

                    resolve();
                });
            });

            return writableStream.getContents() || Buffer.from([]);
        };