Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Upload blob to windows azure container using NodeJS (CompoundJS)

Upload blob to windows azure container using NodeJS (CompoundJS)

Problem

I am using CompoundJS for my application and now trying to implement a script which would upload images to Azure blob from compoundjs.

I searched web and found that there is a module azure (npm install azure) as specified in this link.

Below is the code snippet i used in my application

var azure = require("azure");
var blobService = azure.createBlobService();
blobService.createContainerIfNotExists('container_name', {publicAccessLevel : 'blob'}, function(error){
    if(!error){
        // Container exists and is public
        console.log("Container Exists");
    }
});

I am aware that i should configure ACCESS KEY some where to make this work, but not sure where.

Please suggest.

Problem courtesy of: balanv

Solution

You would need to provide your account name/key like this:

var blobService = azure.createBlobService('accountname', 'accountkey');

You can look at the source code here: https://github.com/WindowsAzure/azure-sdk-for-node/blob/master/lib/azure.js.

Solution courtesy of: Gaurav Mantri

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Upload blob to windows azure container using NodeJS (CompoundJS)

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×