From 82b545da3c9f15c14c497332806f82ec1f47c416 Mon Sep 17 00:00:00 2001 From: David Kanda Date: Thu, 3 Aug 2017 05:19:35 +0000 Subject: [PATCH] Added support for bucket acl in options. --- README.md | 3 ++- index.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6010f36..9fd1c4f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,8 @@ req.file('avatar') secret: 'AB2g1939eaGAdesoccertournament', bucket: 'my_stuff', // Optional - token: 'temporary_sts_creds' + token: 'temporary_sts_creds', + acl: 'public-read', }, function whenDone(err, uploadedFiles) { if (err) { return res.serverError(err); diff --git a/index.js b/index.js index 7a4bae8..36087c6 100644 --- a/index.js +++ b/index.js @@ -244,6 +244,11 @@ module.exports = function SkipperS3 (globalOpts) { headers['content-type'] = mime.lookup(__newFile.fd); } + // Add acl to the headers if it was set in the options. + if (options.hasOwnProperty('acl') && typeof options['acl'] === 'string'){ + headers['x-amz-acl'] = options['acl']; + } + var bytesWritten = 0; var mpu = new S3MultipartUpload({