node package manager

s3signer

Transform stream which reads S3 object keys and writes presigned S3 urls

s3signer

Transform stream which reads S3 object keys and writes presigned S3 urls.

dependency status

Methods

var s3signer = require('s3signer')(opts);

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.
  • opts.ttl - Miliseconds until signed urls expire

var signer = s3signer(ttl)

Return a transform stream which reads S3 object keys and writes presigned urls expiring when ttl in milliseconds passes.

Example

var s3signer = require('s3signer')({
  key: process.env.AWS_ACCESS_KEY,
  secret: process.env.AWS_SECRET_KEY,
  region: process.env.AWS_REGION,
  bucket: process.env.S3_BUCKET
});
 
var signer = s3signer(60*1000);
 
signer.pipe(process.stdout);
 
signer.write('img/me.jpg');
signer.write('img/you.jpg');

License

MIT