Git Product home page Git Product logo

storage-blobs-node-quickstart's Introduction

page_type languages products description urlFragment
sample
javascript
azure
You are viewing a tutorial for the legacy version of the Azure Storage Node.js SDK.
storage-blobs-node-quickstart

Storage Blobs Quickstart

WARNING Samples in this repository use older package azure-storage for Azure Storage Blobs. We recommend that you refer to the samples that use the new package @azure/storage-blob instead.

The following sample includes the following features:

  • Uses async/await: The Azure Storage SDK API is still callback-based, but the approach in this sample modernizes the syntax. API calls are wrapped in Promises and are executed in the context of an async/await operation.

  • Uses environment variables: This sample accesses the connection string from an environment variable. The use of environment variables is representative of how you would access sensitive information in production.

To run this sample, you need an Azure account, a blob storage account, and the associated blob storage connection string.

Set up

First, clone the repository on your machine:

git clone https://github.com/Azure-Samples/storage-blobs-node-quickstart.git

Then, switch to the appropriate folder:

cd storage-blobs-node-quickstart

Next, install the dependencies:

npm install

Now, add your blob storage connection string as an environment variable named AZURE_STORAGE_CONNECTION_STRING to a file named .env.

Note: This repository includes a file named .env.example. You can rename this file by removing .example and adding the correct value for your connection string in the .env file.

Running the sample

Once the setup, you can run the sample by using npm start.

npm start

When complete, the application should produce output similar to the following:

Containers:
 - container-one
 - container-two
Container "demo" is created
Blob "quickstart.txt" is uploaded
Local file "./readme.md" is uploaded
Blobs in "demo" container:
 - quickstart.txt
 - readme.md
Blob downloaded blob content: "hello Blob SDK"
Blob "quickstart.txt" is deleted
Container "demo" is deleted
Done

Resources

You can use the Azure Storage Explorer to see the data in your Azure account.

storage-blobs-node-quickstart's People

Contributors

craigshoemaker avatar georgewallace avatar hyoshioka0128 avatar jongio avatar microsoftopensource avatar msftgits avatar tamram avatar v-rajagt-zz avatar xiaoningliu avatar zzhxiaofeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

storage-blobs-node-quickstart's Issues

createContainer command fails with a syntax error

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Clone the repo.
Create a .env file and add the connection string.
Run npm install.
Run node index.js --command createContainer.

Any log messages given by the failure

[mjain] ~/Documents/nodejs/storage-blobs-node-quickstart$ node index.js --command createContainer
/Users/manik.jain/Documents/nodejs/storage-blobs-node-quickstart/index.js:90
const executeCommand = async () => {
                             ^

SyntaxError: Unexpected token (
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

Expected/desired behavior

Create a container or post a success message.

OS and Version?

macOS High Sierra

Versions

node version: v6.11.2

Mention any other details that might be useful

Following the doc here: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-nodejs


Thanks! We'll be in touch soon.

[Action Needed] This repo is inactive

This GitHub repository has been identified as a candidate for archival

This repository has had no activity for more than 2 years. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.

Please see https://aka.ms/sunsetting-faq to learn more about this process.

Action

✍️

❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒

If you take no action, this repository is still inactive 30 days from today it will be automatically archived..

Need more help? 🖐️

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.