diff --git a/README.md b/README.md index 51a15ac..38a7ae4 100644 --- a/README.md +++ b/README.md @@ -177,6 +177,7 @@ Create a through stream, that push files to s3. - noAcl: do not set x-amz-acl by default - simulate: debugging option to simulate s3 upload - createOnly: skip file updates + - newFile: create new file instead of skipping file updates Files that go through the stream receive extra properties: diff --git a/lib/index.js b/lib/index.js index 50ad35e..d50a7bb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -82,8 +82,9 @@ module.exports._toAwsParams = toAwsParams; * @api private */ -function initFile(file) { - if (!file.s3) { +function initFile(file, newFile) { + newFile = newFile || false; + if (!file.s3 || newFile) { file.s3 = {}; file.s3.headers = {}; file.s3.path = file.relative.replace(/\\/g, '/'); @@ -320,7 +321,7 @@ Publisher.prototype.publish = function (headers, options) { // check if file.contents is a `Buffer` if (file.isBuffer()) { - initFile(file); + initFile(file, options.newFile); // calculate etag etag = '"' + md5Hash(file.contents) + '"';