NodeJS module for Azure Blob Storage


image

Our team member Sven Lito just released a new module for Azure Blob Storage, which you can find at the following address:

azure-blob-store

Example

var AzureBlobStore = require(‘azure-blob-store’);
var store = new AzureBlobStore({  
 accountName: process.env.AZURESTORAGEACCOUNT,  
 accountKey: process.env.AZURESTORAGEACCESSKEY,  
 container: process.env.AZURESTORAGECONTAINER  
});// write to azure  
fs.createReadStream(‘/tmp/somefile.txt’)

.pipe(store.createWriteStream({ key: ‘somefile.txt’ })); // read from azure  
store.createReadStream({ key: ‘somefile.txt’ })  
.pipe(fs.createWriteStream(‘/tmp/somefile.txt’));// remove  
store.remove({ key: ‘somefile.txt’ }, function(err) {  
    store.exists({ key: ‘somefile.txt’ }, function(err, exists) {  
    // exists — if false, blob has been removed  
    });  
});// exists  
store.exists({ key: ‘somefile.txt’ }, function(err, exists) {  
 // true if blob exists  
});