2.1.0 • Published 11 years ago
s3ify v2.1.0
s3ify
Writable stream which takes paths and uploads them to S3.
Example
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);
});
Methods
var s = s3ify(opts)
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.
Events
s.on('skip', function (path) {})
For every path already existing in the bucket this event fires.
s.on('upload', function (path) {})
For every path sucessfully uploaded to the bucket this event fires.
s.on('error', function (path) {})
For each error when checking existence of or uploading a path this event fires.
License
MIT