s3ify

Writable stream which takes paths and uploads them to S3

s3ify

Writable stream which takes paths and uploads them to S3.

var s3ify = require('s3ify');
 
var s = s3ify({
  key: process.env.AWS_ACCESS_KEY,
  secret: process.env.AWS_SECRET_KEY,
  region: process.env.AWS_REGION,
  bucket: process.env.AWS_BUCKET
});
 
s.write('test/img/hasselblad.jpg');
 
s.on('skip', function (path) {
  console.log('already uploaded', path);
});
 
s.on('upload', function (path) {
  console.log('uploaded', path);
});
 
s.on('error', function (err) {
  console.error('error', err);
});

Return a writable stream which uploads paths written to it.

The following opts must be passed in:

  • opts.key - AWS access key ID.
  • opts.secret - AWS secret access key.
  • opts.region - AWS geographic region.
  • opts.bucket - Existing S3 bucket for uploads.

For every path already existing in the bucket this event fires.

For every path sucessfully uploaded to the bucket this event fires.

For each error when checking existence of or uploading a path this event fires.

MIT