How to use the azure-storage.AccessCondition 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 microsoft / botbuilder-js / libraries / botbuilder-azure / lib / blobStorage.js View on Github external
let blobs = Object.keys(changes).map((key) => {
                let documentChange = {
                    id: this.sanitizeKey(key),
                    realId: key,
                    document: changes[key]
                };
                let payload = JSON.stringify(documentChange);
                let options = {
                    accessConditions: changes[key].eTag === '*' ? azure.AccessCondition.generateEmptyCondition() : azure.AccessCondition.generateIfMatchCondition(changes[key].eTag),
                    parallelOperationThreadCount: 4
                };
                return {
                    id: documentChange.id,
                    data: payload,
                    options: options
                };
            });
            // A block blob can be uploaded using a single PUT operation or divided into multiple PUT block operations
github Azure / BatchExplorer / scripts / azpipelines / upload-to-storage.js View on Github external
async function createBlobFromLocalFile(container, filename, blobName, override = false) {
    const options = {};
    if (!override) {
        options.accessConditions = azureStorage.AccessCondition.generateIfNotExistsCondition();
    }

    return new Promise((resolve, reject) => {
        blobService.createBlockBlobFromLocalFile(container, blobName, filename, options,
            (error, result, response) => {

                if (error) {
                    reject(error);
                    return;
                }

                console.log("Uploaded", result, response);
                resolve(result);
            });
    });
}
github microsoft / botbuilder-js / libraries / botbuilder-azure / src / blobStorage.ts View on Github external
}[] = Object.keys(changes).map((key: string) => {
                const documentChange: DocumentStoreItem = {
                    id: this.sanitizeKey(key),
                    realId: key,
                    document: changes[key]
                };

                const payload: string = JSON.stringify(documentChange);
                const options: azure.BlobService.CreateBlobRequestOptions = {
                    accessConditions: changes[key].eTag === '*' ?
                        azure.AccessCondition.generateEmptyCondition() : azure.AccessCondition.generateIfMatchCondition(changes[key].eTag),
                    parallelOperationThreadCount: 4
                };

                return {
                    id: documentChange.id,
                    data: payload,
                    options: options
                };
            });