Skip to content

Instantly share code, notes, and snippets.

@johnnyhalife
Created December 2, 2012 20:34
Show Gist options
  • Save johnnyhalife/4190934 to your computer and use it in GitHub Desktop.
Save johnnyhalife/4190934 to your computer and use it in GitHub Desktop.
Backup to Azure
var azure = require('azure'),
fs = require('fs');
var container = "mongo-backups"
var blobService = azure.createBlobService();
blobService.createContainerIfNotExists(container, {}, function (error) {
if(error) return console.error(error);
var fileName = process.argv[2];
blobService.createBlockBlobFromFile(container, fileName, fileName, {}, function (error) {
if(error) return console.error(error);
console.log("successfuly uploaded: %s", fileName);
process.exit(0);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment