web2blob
v0.0.7
Published
Upload all your web assets to Azure Blob Storage with a simple command!
Downloads
11
Maintainers
Keywords
Readme
web2blob
A small utility to upload your web assets to Azure Blob Storage. The idea is that after you build your website with tools like Create React App, you could upload it to a blob, and then put a CDN in front of it.
Requirements
This application requires Node 4+ to run.
What differences does it have with Azure CLI upload-batch?
- Will infer the Content-Type for all your files.
- Will gzip the files for you.
- Will set a Cache-Control for regular assets, and a long cache for static assets.
Install
As a CLI tool
npm install -g web2blob
As a library
npm install --save-dev web2blob
CLI
web2blob -s webfolder -d container [options]
Run web2blob --help
to get a quick overview of all commands.
API Usage
const web2blob = require('web2blob');
const options = {
source: './build', // Path of the folder where to upload the assets.
destination: 'myweb', // Name of the blob container where to upload.
// Default options (no need to pass them)
cache: 3600, // Time in ms to cache regular files.
maxConnections: 5, // Max simultaneous connections to the blob.
statics: 'static', // Folder where to cache files for 1 year.
zip: true // Whether to gzip the files or not.
};
web2blob(options)
.then(() => {
// Files uploaded succesfully to the blob.
})
.catch(error => {
// Something happened.
});