distack
v1.0.2
Published
Distributed Storage Stack
Downloads
17
Maintainers
Readme
Distributed Storage Stack
Read and write to multiple storage systems through one simple API. All read / writes are streamed so large files are no problem. Currently supports serial and parallel writes to:
- Amazon S3
- Local disk
Installation
npm install distack
Quick Start
var DSS = require('distack');
// init
var store = new DSS([
{
'tag' : 'local',
'type': 'Disk',
'cfg' : {...}
},
{
'tag' : 'cloud',
'type': 'S3',
'cfg' : {...}
}
]);
// write
store.write(['local', 'cloud'], 'myKey', 'my/file', function (err) {...});
// read
try {
var readStream = store.read('local', 'myKey');
} catch(e) {...}
Storage services
Amazon S3
var store = new DSS([
{
'tag' : 'cloud',
'type': 'S3',
'cfg' : {
'key' : '<ACCESS_KEY>',
'secret': '<SECRET>',
'region': '<REGION>1',
'bucket': '<BUCKET_NAME>'
}
}
]);
Local Disk Storage
var store = new DSS([
{
'tag' : 'local',
'type': 'Disk',
'cfg' : {
'basedir': './uploads'
}
}
]);