├── .github ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .vscode └── launch.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── v10 ├── .env.example ├── index.js ├── package-lock.json └── package.json └── v12 ├── .env.example ├── index.js ├── package-lock.json └── package.json /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 4 | > Please provide us with the following information: 5 | > --------------------------------------------------------------- 6 | 7 | ### This issue is for a: (mark with an `x`) 8 | ``` 9 | - [ ] bug report -> please search issues before submitting 10 | - [ ] feature request 11 | - [ ] documentation issue or request 12 | - [ ] regression (a behavior that used to work and stopped in a new release) 13 | ``` 14 | 15 | ### Minimal steps to reproduce 16 | > 17 | 18 | ### Any log messages given by the failure 19 | > 20 | 21 | ### Expected/desired behavior 22 | > 23 | 24 | ### OS and Version? 25 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?) 26 | 27 | ### Versions 28 | > 29 | 30 | ### Mention any other details that might be useful 31 | 32 | > --------------------------------------------------------------- 33 | > Thanks! We'll be in touch soon. 34 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Purpose 2 | 3 | * ... 4 | 5 | ## Does this introduce a breaking change? 6 | 7 | ``` 8 | [ ] Yes 9 | [ ] No 10 | ``` 11 | 12 | ## Pull Request Type 13 | What kind of change does this Pull Request introduce? 14 | 15 | 16 | ``` 17 | [ ] Bugfix 18 | [ ] Feature 19 | [ ] Code style update (formatting, local variables) 20 | [ ] Refactoring (no functional changes, no api changes) 21 | [ ] Documentation content changes 22 | [ ] Other... Please describe: 23 | ``` 24 | 25 | ## How to Test 26 | * Get the code 27 | 28 | ``` 29 | git clone [repo-address] 30 | cd [repo-name] 31 | git checkout [branch-name] 32 | npm install 33 | ``` 34 | 35 | * Test the code 36 | 37 | ``` 38 | ``` 39 | 40 | ## What to Check 41 | Verify that the following are valid 42 | * ... 43 | 44 | ## Other Information 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "Launch Program", 11 | "program": "${workspaceFolder}\\index.js" 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [project-title] Changelog 2 | 3 | 4 | # x.y.z (yyyy-mm-dd) 5 | 6 | *Features* 7 | * ... 8 | 9 | *Bug Fixes* 10 | * ... 11 | 12 | *Breaking Changes* 13 | * ... 14 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to [project-title] 2 | 3 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 4 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 5 | the rights to use your contribution. For details, visit https://cla.microsoft.com. 6 | 7 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide 8 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions 9 | provided by the bot. You will only need to do this once across all repos using our CLA. 10 | 11 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 12 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 13 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 14 | 15 | - [Code of Conduct](#coc) 16 | - [Issues and Bugs](#issue) 17 | - [Feature Requests](#feature) 18 | - [Submission Guidelines](#submit) 19 | 20 | ## Code of Conduct 21 | Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 22 | 23 | ## Found an Issue? 24 | If you find a bug in the source code or a mistake in the documentation, you can help us by 25 | [submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can 26 | [submit a Pull Request](#submit-pr) with a fix. 27 | 28 | ## Want a Feature? 29 | You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub 30 | Repository. If you would like to *implement* a new feature, please submit an issue with 31 | a proposal for your work first, to be sure that we can use it. 32 | 33 | * **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr). 34 | 35 | ## Submission Guidelines 36 | 37 | ### Submitting an Issue 38 | Before you submit an issue, search the archive, maybe your question was already answered. 39 | 40 | If your issue appears to be a bug, and hasn't been reported, open a new issue. 41 | Help us to maximize the effort we can spend fixing issues and adding new 42 | features, by not reporting duplicate issues. Providing the following information will increase the 43 | chances of your issue being dealt with quickly: 44 | 45 | * **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps 46 | * **Version** - what version is affected (e.g. 0.1.2) 47 | * **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you 48 | * **Browsers and Operating System** - is this a problem with all browsers? 49 | * **Reproduce the Error** - provide a live example or a unambiguous set of steps 50 | * **Related Issues** - has a similar issue been reported before? 51 | * **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be 52 | causing the problem (line of code or commit) 53 | 54 | You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new]. 55 | 56 | ### Submitting a Pull Request (PR) 57 | Before you submit your Pull Request (PR) consider the following guidelines: 58 | 59 | * Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR 60 | that relates to your submission. You don't want to duplicate effort. 61 | 62 | * Make your changes in a new git fork: 63 | 64 | * Commit your changes using a descriptive commit message 65 | * Push your fork to GitHub: 66 | * In GitHub, create a pull request 67 | * If we suggest changes then: 68 | * Make the required updates. 69 | * Rebase your fork and force push to your GitHub repository (this will update your Pull Request): 70 | 71 | ```shell 72 | git rebase master -i 73 | git push -f 74 | ``` 75 | 76 | That's it! Thank you for your contribution! 77 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | page_type: sample 3 | languages: 4 | - javascript 5 | - nodejs 6 | products: 7 | - azure 8 | - azure-storage 9 | description: "How to upload and download blobs from Azure Blob Storage with JavaScript." 10 | urlFragment: upload-download-blobs-javascript 11 | --- 12 | 13 | # How to upload and download blobs from Azure Blob Storage with JavaScript 14 | 15 | This repository implements the [Quickstart] sample for the [Azure Storage v10 SDK for JavaScript]. 16 | 17 | ## SDK Versions 18 | You will find the following folders: 19 | * **v10** - references Key Vault SDK v10 20 | * **v12** - references Key Vault SDK v12 21 | 22 | ## Prerequisites 23 | Step 1 : Create a new general-purpose storage account to use for this tutorial. 24 | 25 | * Go to the [Azure Portal] and log in using your Azure account. 26 | * Select **New** > **Storage** > **Storage account**. 27 | * Select your Subscription. 28 | * For `Resource group`, create a new one and give it a unique name. 29 | * Enter a name for your storage account. 30 | * Select the `Location` to use for your Storage Account. 31 | * Set `Account kind` to **StorageV2(general purpose v2)**. 32 | * Set `Performance` to **Standard**. 33 | * Set `Replication` to **Locally-redundant storage (LRS)**. 34 | * Set `Secure transfer required` to **Disabled**. 35 | * Check **Review + create** and click **Create** to create your Storage Account. 36 | 37 | > NOTE: Disabling secure transfer is for sample purposes only to allow requests originating from an insecure connection to the storage API. Microsoft recommends that you always require [secure transfer](https://docs.microsoft.com/en-us/azure/storage/common/storage-require-secure-transfer) for all of your storage accounts. 38 | 39 | Step 2 : Copy and save keys. 40 | 41 | * After your storage account is created, click on it to open it. Select **Settings** > **Access keys** > **Key1**, copy the associated **Connection string** to the clipboard, then paste it into a text editor for later use. 42 | 43 | ## Set up 44 | 45 | 1.Clone 46 | 47 | Clone the repository on your machine: 48 | 49 | ```bash 50 | git clone https://github.com/Azure-Samples/azure-sdk-for-js-storage-blob-upload-download.git 51 | ``` 52 | 53 | 2.Switch Folder 54 | 55 | Then, switch to the appropriate folder: 56 | 57 | ```bash 58 | cd v10 59 | ``` 60 | 61 | or 62 | 63 | ```bash 64 | cd v12 65 | ``` 66 | 67 | 3.Install Dependencies 68 | 69 | Next, install the dependencies: 70 | 71 | npm install 72 | 73 | Finally, rename the file `.env.example` to `.env` and add your values for *AZURE_STORAGE_ACCOUNT_NAME* by using the name of your storage account and *AZURE_STORAGE_ACCOUNT_ACCESS_KEY* which you had copied from **Key1** and pasted in the text editor earlier. 74 | 75 | 76 | ## Running the sample 77 | 78 | Execute the following command in a terminal to start the sample: 79 | 80 | ```bash 81 | npm start 82 | ``` 83 | 84 | The output of this command will be the following: 85 | 86 | ```bash 87 | Containers: 88 | - container-a 89 | - container-b 90 | Container: "demo" is created 91 | Blob "quickstart.txt" is uploaded 92 | Local file "../README.md" is uploaded 93 | Blobs in "demo" container: 94 | - quickstart.txt 95 | - README-STREAM.md 96 | - README.md 97 | Downloaded blob content: "Hello Node SDK" 98 | Block blob "quickstart.txt" is deleted 99 | Container "demo" is deleted 100 | Done 101 | ``` 102 | 103 | 104 | [Quickstart]: http://docs.microsoft.com/azure/storage/blobs/storage-quickstart-blobs-nodejs-v10 105 | [Azure Storage v10 SDK for JavaScript]: https://github.com/Azure/azure-storage-js 106 | [Azure Portal]: https://portal.azure.com 107 | -------------------------------------------------------------------------------- /v10/.env.example: -------------------------------------------------------------------------------- 1 | AZURE_STORAGE_ACCOUNT_NAME= 2 | AZURE_STORAGE_ACCOUNT_ACCESS_KEY= -------------------------------------------------------------------------------- /v10/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | Aborter, 3 | BlockBlobURL, 4 | ContainerURL, 5 | ServiceURL, 6 | SharedKeyCredential, 7 | StorageURL, 8 | uploadStreamToBlockBlob, 9 | uploadFileToBlockBlob 10 | } = require('@azure/storage-blob'); 11 | 12 | const fs = require("fs"); 13 | const path = require("path"); 14 | 15 | if (process.env.NODE_ENV !== "production") { 16 | require("dotenv").config(); 17 | } 18 | 19 | const STORAGE_ACCOUNT_NAME = process.env.AZURE_STORAGE_ACCOUNT_NAME; 20 | const ACCOUNT_ACCESS_KEY = process.env.AZURE_STORAGE_ACCOUNT_ACCESS_KEY; 21 | 22 | const ONE_MEGABYTE = 1024 * 1024; 23 | const FOUR_MEGABYTES = 4 * ONE_MEGABYTE; 24 | const ONE_MINUTE = 60 * 1000; 25 | 26 | async function showContainerNames(aborter, serviceURL) { 27 | let marker = undefined; 28 | 29 | do { 30 | const listContainersResponse = await serviceURL.listContainersSegment(aborter, marker); 31 | marker = listContainersResponse.nextMarker; 32 | for(let container of listContainersResponse.containerItems) { 33 | console.log(` - ${ container.name }`); 34 | } 35 | } while (marker); 36 | } 37 | 38 | async function uploadLocalFile(aborter, containerURL, filePath) { 39 | filePath = path.resolve(filePath); 40 | 41 | const fileName = path.basename(filePath); 42 | const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, fileName); 43 | 44 | return await uploadFileToBlockBlob(aborter, filePath, blockBlobURL); 45 | } 46 | 47 | async function uploadStream(aborter, containerURL, filePath) { 48 | filePath = path.resolve(filePath); 49 | 50 | const fileName = path.basename(filePath).replace('.md', '-STREAM.md'); 51 | const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, fileName); 52 | 53 | const stream = fs.createReadStream(filePath, { 54 | highWaterMark: FOUR_MEGABYTES, 55 | }); 56 | 57 | const uploadOptions = { 58 | bufferSize: FOUR_MEGABYTES, 59 | maxBuffers: 5, 60 | }; 61 | 62 | return await uploadStreamToBlockBlob( 63 | aborter, 64 | stream, 65 | blockBlobURL, 66 | uploadOptions.bufferSize, 67 | uploadOptions.maxBuffers); 68 | } 69 | 70 | async function showBlobNames(aborter, containerURL) { 71 | let marker = undefined; 72 | 73 | do { 74 | const listBlobsResponse = await containerURL.listBlobFlatSegment(Aborter.none, marker); 75 | marker = listBlobsResponse.nextMarker; 76 | for (const blob of listBlobsResponse.segment.blobItems) { 77 | console.log(` - ${ blob.name }`); 78 | } 79 | } while (marker); 80 | } 81 | 82 | // A helper method used to read a Node.js readable stream into string 83 | async function streamToString(readableStream) { 84 | return new Promise((resolve, reject) => { 85 | const chunks = []; 86 | readableStream.on("data", data => { 87 | chunks.push(data.toString()); 88 | }); 89 | readableStream.on("end", () => { 90 | resolve(chunks.join("")); 91 | }); 92 | readableStream.on("error", reject); 93 | }); 94 | } 95 | 96 | async function execute() { 97 | 98 | const containerName = "demo"; 99 | const blobName = "quickstart.txt"; 100 | const content = "Hello Node SDK"; 101 | const localFilePath = "../README.md"; 102 | 103 | const credentials = new SharedKeyCredential(STORAGE_ACCOUNT_NAME, ACCOUNT_ACCESS_KEY); 104 | const pipeline = StorageURL.newPipeline(credentials); 105 | const serviceURL = new ServiceURL(`https://${STORAGE_ACCOUNT_NAME}.blob.core.windows.net`, pipeline); 106 | 107 | const containerURL = ContainerURL.fromServiceURL(serviceURL, containerName); 108 | const blockBlobURL = BlockBlobURL.fromContainerURL(containerURL, blobName); 109 | 110 | const aborter = Aborter.timeout(30 * ONE_MINUTE); 111 | 112 | await containerURL.create(aborter); 113 | console.log(`Container: "${containerName}" is created`); 114 | 115 | console.log("Containers:"); 116 | await showContainerNames(aborter, serviceURL); 117 | 118 | await blockBlobURL.upload(aborter, content, content.length); 119 | console.log(`Blob "${blobName}" is uploaded`); 120 | 121 | await uploadLocalFile(aborter, containerURL, localFilePath); 122 | console.log(`Local file "${localFilePath}" is uploaded`); 123 | 124 | await uploadStream(aborter, containerURL, localFilePath); 125 | console.log(`Local file "${localFilePath}" is uploaded as a stream`); 126 | 127 | console.log(`Blobs in "${containerName}" container:`); 128 | await showBlobNames(aborter, containerURL); 129 | 130 | const downloadResponse = await blockBlobURL.download(aborter, 0); 131 | const downloadedContent = await streamToString(downloadResponse.readableStreamBody); 132 | console.log(`Downloaded blob content: "${downloadedContent}"`); 133 | 134 | await blockBlobURL.delete(aborter) 135 | console.log(`Block blob "${blobName}" is deleted`); 136 | 137 | await containerURL.delete(aborter); 138 | console.log(`Container "${containerName}" is deleted`); 139 | } 140 | 141 | execute().then(() => console.log("Done")).catch((e) => console.log(e)); 142 | -------------------------------------------------------------------------------- /v10/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azure-storage-blob-nodejs-v10-quickstart", 3 | "version": "1.1.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@azure/ms-rest-js": { 8 | "version": "2.0.4", 9 | "resolved": "https://registry.npmjs.org/@azure/ms-rest-js/-/ms-rest-js-2.0.4.tgz", 10 | "integrity": "sha512-nSOPt6st0RtxclYBQV65qXZpvMDqiDQssktvB/SMTAJ5bIytSPtBmlttTTigO5qHvwQcfzzpQE0sMceK+dJ/IQ==", 11 | "requires": { 12 | "@types/node-fetch": "^2.3.7", 13 | "@types/tunnel": "0.0.1", 14 | "abort-controller": "^3.0.0", 15 | "form-data": "^2.5.0", 16 | "node-fetch": "^2.6.0", 17 | "tough-cookie": "^3.0.1", 18 | "tslib": "^1.10.0", 19 | "tunnel": "0.0.6", 20 | "uuid": "^3.3.2", 21 | "xml2js": "^0.4.19" 22 | } 23 | }, 24 | "@azure/storage-blob": { 25 | "version": "10.5.0", 26 | "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-10.5.0.tgz", 27 | "integrity": "sha512-67+0EP7STy9BQgzvN1RgmSvXhxRd044eDgepX7zBp7XslBxz8YGo2cSLm9w5o5Qf1FLCRlwuziRMikaPCLMpVw==", 28 | "requires": { 29 | "@azure/ms-rest-js": "^2.0.0", 30 | "events": "^3.0.0", 31 | "tslib": "^1.9.3" 32 | } 33 | }, 34 | "@types/dotenv": { 35 | "version": "4.0.3", 36 | "resolved": "https://registry.npmjs.org/@types/dotenv/-/dotenv-4.0.3.tgz", 37 | "integrity": "sha512-mmhpINC/HcLGQK5ikFJlLXINVvcxhlrV+ZOUJSN7/ottYl+8X4oSXzS9lBtDkmWAl96EGyGyLrNvk9zqdSH8Fw==", 38 | "requires": { 39 | "@types/node": "*" 40 | } 41 | }, 42 | "@types/node": { 43 | "version": "9.6.31", 44 | "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.31.tgz", 45 | "integrity": "sha512-kIVlvUBizL51ALNMPbmcZoM7quHyB7J6fLRwQe22JsMp39nrVSHdBeVVS3fnQCK1orxI3O8LScmb8cuiihkAfA==" 46 | }, 47 | "@types/node-fetch": { 48 | "version": "2.5.1", 49 | "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.1.tgz", 50 | "integrity": "sha512-nYsC20tHanaNa4coFvCDcuIvtdvu8YkQz0XQOoBHL1X1y1QxeNe73dg1PaLGqsJNWiVwK0bjn5Jf+ZQpE6acJg==", 51 | "requires": { 52 | "@types/node": "*" 53 | } 54 | }, 55 | "@types/tunnel": { 56 | "version": "0.0.1", 57 | "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.1.tgz", 58 | "integrity": "sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==", 59 | "requires": { 60 | "@types/node": "*" 61 | } 62 | }, 63 | "abort-controller": { 64 | "version": "3.0.0", 65 | "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", 66 | "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", 67 | "requires": { 68 | "event-target-shim": "^5.0.0" 69 | } 70 | }, 71 | "asynckit": { 72 | "version": "0.4.0", 73 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 74 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 75 | }, 76 | "combined-stream": { 77 | "version": "1.0.8", 78 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 79 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 80 | "requires": { 81 | "delayed-stream": "~1.0.0" 82 | } 83 | }, 84 | "define-properties": { 85 | "version": "1.1.3", 86 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", 87 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", 88 | "requires": { 89 | "object-keys": "^1.0.12" 90 | } 91 | }, 92 | "delayed-stream": { 93 | "version": "1.0.0", 94 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 95 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 96 | }, 97 | "dotenv": { 98 | "version": "6.0.0", 99 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.0.0.tgz", 100 | "integrity": "sha512-FlWbnhgjtwD+uNLUGHbMykMOYQaTivdHEmYwAKFjn6GKe/CqY0fNae93ZHTd20snh9ZLr8mTzIL9m0APQ1pjQg==" 101 | }, 102 | "es-abstract": { 103 | "version": "1.14.2", 104 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz", 105 | "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==", 106 | "requires": { 107 | "es-to-primitive": "^1.2.0", 108 | "function-bind": "^1.1.1", 109 | "has": "^1.0.3", 110 | "has-symbols": "^1.0.0", 111 | "is-callable": "^1.1.4", 112 | "is-regex": "^1.0.4", 113 | "object-inspect": "^1.6.0", 114 | "object-keys": "^1.1.1", 115 | "string.prototype.trimleft": "^2.0.0", 116 | "string.prototype.trimright": "^2.0.0" 117 | } 118 | }, 119 | "es-to-primitive": { 120 | "version": "1.2.0", 121 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", 122 | "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", 123 | "requires": { 124 | "is-callable": "^1.1.4", 125 | "is-date-object": "^1.0.1", 126 | "is-symbol": "^1.0.2" 127 | } 128 | }, 129 | "event-target-shim": { 130 | "version": "5.0.1", 131 | "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", 132 | "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" 133 | }, 134 | "events": { 135 | "version": "3.0.0", 136 | "resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz", 137 | "integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==" 138 | }, 139 | "form-data": { 140 | "version": "2.5.1", 141 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", 142 | "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", 143 | "requires": { 144 | "asynckit": "^0.4.0", 145 | "combined-stream": "^1.0.6", 146 | "mime-types": "^2.1.12" 147 | } 148 | }, 149 | "function-bind": { 150 | "version": "1.1.1", 151 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 152 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 153 | }, 154 | "has": { 155 | "version": "1.0.3", 156 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 157 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 158 | "requires": { 159 | "function-bind": "^1.1.1" 160 | } 161 | }, 162 | "has-symbols": { 163 | "version": "1.0.0", 164 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", 165 | "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" 166 | }, 167 | "ip-regex": { 168 | "version": "2.1.0", 169 | "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", 170 | "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=" 171 | }, 172 | "is-callable": { 173 | "version": "1.1.4", 174 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", 175 | "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" 176 | }, 177 | "is-date-object": { 178 | "version": "1.0.1", 179 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", 180 | "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" 181 | }, 182 | "is-regex": { 183 | "version": "1.0.4", 184 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", 185 | "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", 186 | "requires": { 187 | "has": "^1.0.1" 188 | } 189 | }, 190 | "is-symbol": { 191 | "version": "1.0.2", 192 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", 193 | "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", 194 | "requires": { 195 | "has-symbols": "^1.0.0" 196 | } 197 | }, 198 | "mime-db": { 199 | "version": "1.40.0", 200 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 201 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" 202 | }, 203 | "mime-types": { 204 | "version": "2.1.24", 205 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 206 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 207 | "requires": { 208 | "mime-db": "1.40.0" 209 | } 210 | }, 211 | "node-fetch": { 212 | "version": "2.6.0", 213 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", 214 | "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" 215 | }, 216 | "object-inspect": { 217 | "version": "1.6.0", 218 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", 219 | "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" 220 | }, 221 | "object-keys": { 222 | "version": "1.1.1", 223 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", 224 | "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" 225 | }, 226 | "object.getownpropertydescriptors": { 227 | "version": "2.0.3", 228 | "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", 229 | "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", 230 | "requires": { 231 | "define-properties": "^1.1.2", 232 | "es-abstract": "^1.5.1" 233 | } 234 | }, 235 | "psl": { 236 | "version": "1.4.0", 237 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", 238 | "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" 239 | }, 240 | "punycode": { 241 | "version": "2.1.1", 242 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 243 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 244 | }, 245 | "sax": { 246 | "version": "1.2.4", 247 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 248 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 249 | }, 250 | "string.prototype.trimleft": { 251 | "version": "2.1.0", 252 | "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", 253 | "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", 254 | "requires": { 255 | "define-properties": "^1.1.3", 256 | "function-bind": "^1.1.1" 257 | } 258 | }, 259 | "string.prototype.trimright": { 260 | "version": "2.1.0", 261 | "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", 262 | "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", 263 | "requires": { 264 | "define-properties": "^1.1.3", 265 | "function-bind": "^1.1.1" 266 | } 267 | }, 268 | "tough-cookie": { 269 | "version": "3.0.1", 270 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", 271 | "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", 272 | "requires": { 273 | "ip-regex": "^2.1.0", 274 | "psl": "^1.1.28", 275 | "punycode": "^2.1.1" 276 | } 277 | }, 278 | "tslib": { 279 | "version": "1.10.0", 280 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", 281 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" 282 | }, 283 | "tunnel": { 284 | "version": "0.0.6", 285 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 286 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 287 | }, 288 | "util.promisify": { 289 | "version": "1.0.0", 290 | "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", 291 | "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", 292 | "requires": { 293 | "define-properties": "^1.1.2", 294 | "object.getownpropertydescriptors": "^2.0.3" 295 | } 296 | }, 297 | "uuid": { 298 | "version": "3.3.3", 299 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", 300 | "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" 301 | }, 302 | "xml2js": { 303 | "version": "0.4.22", 304 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.22.tgz", 305 | "integrity": "sha512-MWTbxAQqclRSTnehWWe5nMKzI3VmJ8ltiJEco8akcC6j3miOhjjfzKum5sId+CWhfxdOs/1xauYr8/ZDBtQiRw==", 306 | "requires": { 307 | "sax": ">=0.6.0", 308 | "util.promisify": "~1.0.0", 309 | "xmlbuilder": "~11.0.0" 310 | } 311 | }, 312 | "xmlbuilder": { 313 | "version": "11.0.1", 314 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 315 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" 316 | } 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /v10/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azure-storage-blob-nodejs-v10-quickstart", 3 | "version": "1.1.0", 4 | "description": "Use the @azure/storage-blob SDK to interact with Azure Blob storage", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "Craig Shoemaker ", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@azure/storage-blob": "^10.5.0", 13 | "@types/dotenv": "^4.0.3", 14 | "dotenv": "^6.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /v12/.env.example: -------------------------------------------------------------------------------- 1 | AZURE_STORAGE_ACCOUNT_NAME= 2 | AZURE_STORAGE_ACCOUNT_ACCESS_KEY= -------------------------------------------------------------------------------- /v12/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | StorageSharedKeyCredential, 3 | BlobServiceClient 4 | } = require('@azure/storage-blob'); 5 | const {AbortController} = require('@azure/abort-controller'); 6 | const fs = require("fs"); 7 | const path = require("path"); 8 | 9 | if (process.env.NODE_ENV !== "production") { 10 | require("dotenv").config(); 11 | } 12 | 13 | const STORAGE_ACCOUNT_NAME = process.env.AZURE_STORAGE_ACCOUNT_NAME; 14 | const ACCOUNT_ACCESS_KEY = process.env.AZURE_STORAGE_ACCOUNT_ACCESS_KEY; 15 | 16 | const ONE_MEGABYTE = 1024 * 1024; 17 | const FOUR_MEGABYTES = 4 * ONE_MEGABYTE; 18 | const ONE_MINUTE = 60 * 1000; 19 | 20 | async function showContainerNames(aborter, blobServiceClient) { 21 | let iter = await blobServiceClient.listContainers(aborter); 22 | for await (const container of iter) { 23 | console.log(` - ${container.name}`); 24 | } 25 | } 26 | 27 | async function uploadLocalFile(aborter, containerClient, filePath) { 28 | filePath = path.resolve(filePath); 29 | 30 | const fileName = path.basename(filePath); 31 | 32 | const blobClient = containerClient.getBlobClient(fileName); 33 | const blockBlobClient = blobClient.getBlockBlobClient(); 34 | 35 | return await blockBlobClient.uploadFile(filePath,aborter); 36 | } 37 | 38 | async function uploadStream(aborter, containerClient, filePath) { 39 | filePath = path.resolve(filePath); 40 | 41 | const fileName = path.basename(filePath).replace('.md', '-STREAM.md'); 42 | 43 | const blobClient = containerClient.getBlobClient(fileName); 44 | const blockBlobClient = blobClient.getBlockBlobClient(); 45 | 46 | const stream = fs.createReadStream(filePath, { 47 | highWaterMark: FOUR_MEGABYTES, 48 | }); 49 | 50 | const uploadOptions = { 51 | bufferSize: FOUR_MEGABYTES, 52 | maxBuffers: 5, 53 | }; 54 | 55 | return await blockBlobClient.uploadStream( 56 | stream, 57 | uploadOptions.bufferSize, 58 | uploadOptions.maxBuffers, 59 | aborter); 60 | } 61 | 62 | async function showBlobNames(aborter, containerClient) { 63 | 64 | let iter = await containerClient.listBlobsFlat(aborter); 65 | for await (const blob of iter) { 66 | console.log(` - ${blob.name}`); 67 | } 68 | } 69 | 70 | // [Node.js only] A helper method used to read a Node.js readable stream into string 71 | async function streamToString(readableStream) { 72 | return new Promise((resolve, reject) => { 73 | const chunks = []; 74 | readableStream.on("data", (data) => { 75 | chunks.push(data.toString()); 76 | }); 77 | readableStream.on("end", () => { 78 | resolve(chunks.join("")); 79 | }); 80 | readableStream.on("error", reject); 81 | }); 82 | } 83 | 84 | async function execute() { 85 | 86 | const containerName = "demo"; 87 | const blobName = "quickstart.txt"; 88 | const content = "Hello Node SDK"; 89 | const localFilePath = "../README.md"; 90 | 91 | const credentials = new StorageSharedKeyCredential(STORAGE_ACCOUNT_NAME, ACCOUNT_ACCESS_KEY); 92 | 93 | const blobServiceClient = new BlobServiceClient(`https://${STORAGE_ACCOUNT_NAME}.blob.core.windows.net`,credentials); 94 | 95 | const containerClient = blobServiceClient.getContainerClient(containerName); 96 | const blobClient = containerClient.getBlobClient(blobName); 97 | const blockBlobClient = blobClient.getBlockBlobClient(); 98 | 99 | const aborter = AbortController.timeout(30 * ONE_MINUTE); 100 | 101 | await containerClient.create(); 102 | console.log(`Container: "${containerName}" is created`); 103 | 104 | console.log("Containers:"); 105 | await showContainerNames(aborter, blobServiceClient); 106 | 107 | await blockBlobClient.upload(content, content.length, aborter); 108 | console.log(`Blob "${blobName}" is uploaded`); 109 | 110 | await uploadLocalFile(aborter, containerClient, localFilePath); 111 | console.log(`Local file "${localFilePath}" is uploaded`); 112 | 113 | await uploadStream(aborter, containerClient, localFilePath); 114 | console.log(`Local file "${localFilePath}" is uploaded as a stream`); 115 | 116 | console.log(`Blobs in "${containerName}" container:`); 117 | 118 | await showBlobNames(aborter, containerClient); 119 | 120 | const downloadResponse = await blockBlobClient.download(0,aborter); 121 | const downloadedContent = await streamToString(downloadResponse.readableStreamBody); 122 | 123 | console.log(`Downloaded blob content: "${downloadedContent}"`); 124 | 125 | await blockBlobClient.delete(aborter); 126 | console.log(`Block blob "${blobName}" is deleted`); 127 | 128 | await containerClient.delete(aborter); 129 | console.log(`Container "${containerName}" is deleted`); 130 | } 131 | 132 | execute().then(() => console.log("Done")).catch((e) => console.log(e)); 133 | -------------------------------------------------------------------------------- /v12/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azure-storage-blob-nodejs-v10-quickstart", 3 | "version": "1.1.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@azure/abort-controller": { 8 | "version": "1.0.0-preview.2", 9 | "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.0.0-preview.2.tgz", 10 | "integrity": "sha512-pd2MVcHaitEC0ZoeixSTkJqTJFkIUVglosV//P2C/VwLg+9moGyx/P+WH2onDYukEOL5CCEuF0LBDfnTeL0gVA==", 11 | "requires": { 12 | "tslib": "^1.9.3" 13 | } 14 | }, 15 | "@azure/core-asynciterator-polyfill": { 16 | "version": "1.0.0-preview.1", 17 | "resolved": "https://registry.npmjs.org/@azure/core-asynciterator-polyfill/-/core-asynciterator-polyfill-1.0.0-preview.1.tgz", 18 | "integrity": "sha512-hMp0y+j/odkAyTa5TYewn4hUlFdEe3sR9uTd2Oq+se61RtuDsqM7UWrNNlyylPyjIENSZHJVWN7jte/jvvMN2Q==" 19 | }, 20 | "@azure/core-auth": { 21 | "version": "1.0.0-preview.3", 22 | "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.0.0-preview.3.tgz", 23 | "integrity": "sha512-SUG/ccOMGjPVUwKvwAW6r543bd66UOHu66N/jycr0hMVLI/46TuMZJIMjA2AN2+Gc+IrxSXQeJbN2VBFiJBWvA==", 24 | "requires": { 25 | "@azure/abort-controller": "1.0.0-preview.2", 26 | "tslib": "^1.9.3" 27 | } 28 | }, 29 | "@azure/core-http": { 30 | "version": "1.0.0-preview.3", 31 | "resolved": "https://registry.npmjs.org/@azure/core-http/-/core-http-1.0.0-preview.3.tgz", 32 | "integrity": "sha512-YxZPXG0xYRvBhkAtNVD18VG3i6JyS2dH7QtkiYoi9yAc/x7HUMcKg7FmOD/Nf/++OVGoTQcJ9QpG34MggWuHEQ==", 33 | "requires": { 34 | "@azure/abort-controller": "1.0.0-preview.2", 35 | "@azure/core-auth": "1.0.0-preview.3", 36 | "@azure/core-tracing": "1.0.0-preview.2", 37 | "@types/node-fetch": "^2.5.0", 38 | "@types/tunnel": "^0.0.1", 39 | "form-data": "^2.5.0", 40 | "node-fetch": "^2.6.0", 41 | "process": "^0.11.10", 42 | "tough-cookie": "^3.0.1", 43 | "tslib": "^1.9.3", 44 | "tunnel": "^0.0.6", 45 | "uuid": "^3.3.2", 46 | "xml2js": "^0.4.19" 47 | } 48 | }, 49 | "@azure/core-paging": { 50 | "version": "1.0.0-preview.2", 51 | "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.0.0-preview.2.tgz", 52 | "integrity": "sha512-D0oiOmg82AnhTT3xkIyTpEhCesHtlpV2rTVVlCQmQPbfzAWh8eBZp1QAgNQcBdF6uXZrp69znpXSnICmtfH23Q==", 53 | "requires": { 54 | "@azure/core-asynciterator-polyfill": "1.0.0-preview.1" 55 | } 56 | }, 57 | "@azure/core-tracing": { 58 | "version": "1.0.0-preview.2", 59 | "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.0.0-preview.2.tgz", 60 | "integrity": "sha512-ID/kDVax0uYlw1HVBNsLv6JuE8NbgLUrKrmvVqyuvtbNk+Gk+IKbpUbrDMAoauDAd1CHifs+fkg210LD2JWSEQ==", 61 | "requires": { 62 | "tslib": "^1.9.3" 63 | } 64 | }, 65 | "@azure/storage-blob": { 66 | "version": "12.0.0-preview.3", 67 | "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.0.0-preview.3.tgz", 68 | "integrity": "sha512-vbxCCy1VZuuLHsEFgmQK9+dtyuUjKB2+/u+AiVfQPwp4X1K7t2JbpfOd6jFEIvng7qOFJCftLr65x0UwbY085A==", 69 | "requires": { 70 | "@azure/abort-controller": "1.0.0-preview.2", 71 | "@azure/core-http": "1.0.0-preview.3", 72 | "@azure/core-paging": "1.0.0-preview.2", 73 | "events": "^3.0.0", 74 | "tslib": "^1.9.3" 75 | } 76 | }, 77 | "@types/dotenv": { 78 | "version": "4.0.3", 79 | "resolved": "https://registry.npmjs.org/@types/dotenv/-/dotenv-4.0.3.tgz", 80 | "integrity": "sha512-mmhpINC/HcLGQK5ikFJlLXINVvcxhlrV+ZOUJSN7/ottYl+8X4oSXzS9lBtDkmWAl96EGyGyLrNvk9zqdSH8Fw==", 81 | "requires": { 82 | "@types/node": "*" 83 | } 84 | }, 85 | "@types/node": { 86 | "version": "9.6.31", 87 | "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.31.tgz", 88 | "integrity": "sha512-kIVlvUBizL51ALNMPbmcZoM7quHyB7J6fLRwQe22JsMp39nrVSHdBeVVS3fnQCK1orxI3O8LScmb8cuiihkAfA==" 89 | }, 90 | "@types/node-fetch": { 91 | "version": "2.5.0", 92 | "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.0.tgz", 93 | "integrity": "sha512-TLFRywthBgL68auWj+ziWu+vnmmcHCDFC/sqCOQf1xTz4hRq8cu79z8CtHU9lncExGBsB8fXA4TiLDLt6xvMzw==", 94 | "requires": { 95 | "@types/node": "*" 96 | } 97 | }, 98 | "@types/tunnel": { 99 | "version": "0.0.1", 100 | "resolved": "https://registry.npmjs.org/@types/tunnel/-/tunnel-0.0.1.tgz", 101 | "integrity": "sha512-AOqu6bQu5MSWwYvehMXLukFHnupHrpZ8nvgae5Ggie9UwzDR1CCwoXgSSWNZJuyOlCdfdsWMA5F2LlmvyoTv8A==", 102 | "requires": { 103 | "@types/node": "*" 104 | } 105 | }, 106 | "asynckit": { 107 | "version": "0.4.0", 108 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 109 | "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" 110 | }, 111 | "combined-stream": { 112 | "version": "1.0.8", 113 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 114 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 115 | "requires": { 116 | "delayed-stream": "~1.0.0" 117 | } 118 | }, 119 | "define-properties": { 120 | "version": "1.1.3", 121 | "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", 122 | "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", 123 | "requires": { 124 | "object-keys": "^1.0.12" 125 | } 126 | }, 127 | "delayed-stream": { 128 | "version": "1.0.0", 129 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 130 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" 131 | }, 132 | "dotenv": { 133 | "version": "6.2.0", 134 | "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-6.2.0.tgz", 135 | "integrity": "sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==" 136 | }, 137 | "es-abstract": { 138 | "version": "1.14.2", 139 | "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz", 140 | "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==", 141 | "requires": { 142 | "es-to-primitive": "^1.2.0", 143 | "function-bind": "^1.1.1", 144 | "has": "^1.0.3", 145 | "has-symbols": "^1.0.0", 146 | "is-callable": "^1.1.4", 147 | "is-regex": "^1.0.4", 148 | "object-inspect": "^1.6.0", 149 | "object-keys": "^1.1.1", 150 | "string.prototype.trimleft": "^2.0.0", 151 | "string.prototype.trimright": "^2.0.0" 152 | } 153 | }, 154 | "es-to-primitive": { 155 | "version": "1.2.0", 156 | "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", 157 | "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", 158 | "requires": { 159 | "is-callable": "^1.1.4", 160 | "is-date-object": "^1.0.1", 161 | "is-symbol": "^1.0.2" 162 | } 163 | }, 164 | "events": { 165 | "version": "3.0.0", 166 | "resolved": "https://registry.npmjs.org/events/-/events-3.0.0.tgz", 167 | "integrity": "sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA==" 168 | }, 169 | "form-data": { 170 | "version": "2.5.1", 171 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", 172 | "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", 173 | "requires": { 174 | "asynckit": "^0.4.0", 175 | "combined-stream": "^1.0.6", 176 | "mime-types": "^2.1.12" 177 | } 178 | }, 179 | "function-bind": { 180 | "version": "1.1.1", 181 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 182 | "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 183 | }, 184 | "has": { 185 | "version": "1.0.3", 186 | "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 187 | "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 188 | "requires": { 189 | "function-bind": "^1.1.1" 190 | } 191 | }, 192 | "has-symbols": { 193 | "version": "1.0.0", 194 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", 195 | "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" 196 | }, 197 | "ip-regex": { 198 | "version": "2.1.0", 199 | "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", 200 | "integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=" 201 | }, 202 | "is-callable": { 203 | "version": "1.1.4", 204 | "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", 205 | "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" 206 | }, 207 | "is-date-object": { 208 | "version": "1.0.1", 209 | "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", 210 | "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" 211 | }, 212 | "is-regex": { 213 | "version": "1.0.4", 214 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", 215 | "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", 216 | "requires": { 217 | "has": "^1.0.1" 218 | } 219 | }, 220 | "is-symbol": { 221 | "version": "1.0.2", 222 | "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", 223 | "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", 224 | "requires": { 225 | "has-symbols": "^1.0.0" 226 | } 227 | }, 228 | "mime-db": { 229 | "version": "1.40.0", 230 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 231 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" 232 | }, 233 | "mime-types": { 234 | "version": "2.1.24", 235 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 236 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 237 | "requires": { 238 | "mime-db": "1.40.0" 239 | } 240 | }, 241 | "node-fetch": { 242 | "version": "2.6.0", 243 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", 244 | "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" 245 | }, 246 | "object-inspect": { 247 | "version": "1.6.0", 248 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", 249 | "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==" 250 | }, 251 | "object-keys": { 252 | "version": "1.1.1", 253 | "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", 254 | "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" 255 | }, 256 | "object.getownpropertydescriptors": { 257 | "version": "2.0.3", 258 | "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", 259 | "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", 260 | "requires": { 261 | "define-properties": "^1.1.2", 262 | "es-abstract": "^1.5.1" 263 | } 264 | }, 265 | "process": { 266 | "version": "0.11.10", 267 | "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", 268 | "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" 269 | }, 270 | "psl": { 271 | "version": "1.4.0", 272 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", 273 | "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" 274 | }, 275 | "punycode": { 276 | "version": "2.1.1", 277 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", 278 | "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" 279 | }, 280 | "sax": { 281 | "version": "1.2.4", 282 | "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", 283 | "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" 284 | }, 285 | "string.prototype.trimleft": { 286 | "version": "2.1.0", 287 | "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", 288 | "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", 289 | "requires": { 290 | "define-properties": "^1.1.3", 291 | "function-bind": "^1.1.1" 292 | } 293 | }, 294 | "string.prototype.trimright": { 295 | "version": "2.1.0", 296 | "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", 297 | "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", 298 | "requires": { 299 | "define-properties": "^1.1.3", 300 | "function-bind": "^1.1.1" 301 | } 302 | }, 303 | "tough-cookie": { 304 | "version": "3.0.1", 305 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-3.0.1.tgz", 306 | "integrity": "sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg==", 307 | "requires": { 308 | "ip-regex": "^2.1.0", 309 | "psl": "^1.1.28", 310 | "punycode": "^2.1.1" 311 | } 312 | }, 313 | "tslib": { 314 | "version": "1.10.0", 315 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", 316 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" 317 | }, 318 | "tunnel": { 319 | "version": "0.0.6", 320 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 321 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" 322 | }, 323 | "util.promisify": { 324 | "version": "1.0.0", 325 | "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", 326 | "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", 327 | "requires": { 328 | "define-properties": "^1.1.2", 329 | "object.getownpropertydescriptors": "^2.0.3" 330 | } 331 | }, 332 | "uuid": { 333 | "version": "3.3.3", 334 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", 335 | "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" 336 | }, 337 | "xml2js": { 338 | "version": "0.4.22", 339 | "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.22.tgz", 340 | "integrity": "sha512-MWTbxAQqclRSTnehWWe5nMKzI3VmJ8ltiJEco8akcC6j3miOhjjfzKum5sId+CWhfxdOs/1xauYr8/ZDBtQiRw==", 341 | "requires": { 342 | "sax": ">=0.6.0", 343 | "util.promisify": "~1.0.0", 344 | "xmlbuilder": "~11.0.0" 345 | } 346 | }, 347 | "xmlbuilder": { 348 | "version": "11.0.1", 349 | "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", 350 | "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==" 351 | } 352 | } 353 | } 354 | -------------------------------------------------------------------------------- /v12/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azure-storage-blob-nodejs-v10-quickstart", 3 | "version": "1.1.0", 4 | "description": "Use the @azure/storage-blob SDK to interact with Azure Blob storage", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "author": "Craig Shoemaker ", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@azure/abort-controller": "^1.0.0", 13 | "@azure/storage-blob": "^12.0.0", 14 | "@types/dotenv": "^4.0.3", 15 | "dotenv": "^6.2.0" 16 | } 17 | } 18 | --------------------------------------------------------------------------------