Amazon S3 abstract-blob-store
Install with npm
$ npm install s3-blob-store var aws = require('aws-sdk'); var s3blobs = require('s3-blob-store'); var client = new aws.S3({ accessKeyId: process.env.S3_ACCESS_KEY, secretAccessKey: process.env.S3_SECRET_KEY }); var store = s3blobs({ client: client, bucket: 'mybucket' }); // write to s3 fs.createReadStream('/tmp/somefile.txt') .pipe(store.createWriteStream({ key: 'somefile.txt' })); // read from s3 store.createReadStream({ key: 'somefile.txt' }) .pipe(fs.createWriteStream('/tmp/somefile.txt')); // remove store.remove({ key: 'somefile.txt' }, function (err) { // ... }); // exists store.exists({ key: 'somefile.txt' }, function (err, exists) { // ... });Create S3 blob store
Create read stream
opts(ReadStreamOptions | String) options or object key
Returns ReadableStream readable stream of data for the file in your bucket whose key matches
Create write stream
opts(Options<WriteParams> | String) options or object keys3optsdonefunction (Error, {key: String}) callback
Returns WritableStream writable stream that you can pipe data to
Remove object from store
opts({key: String} | String) options containing object key or just keydonefunction (Error) callback
Check if object exits
opts({key: String} | String) options containing object key or just keydonefunction (Error, Boolean) callback
S3 putObject params
Type: Object
keyString object keynameString?keyaliasfilenameString?keyaliasparamsS3Params? additional S3 options
Options including s3-stream-download configuration
S3 client
S3 getObject params
