From 8ca01932e5b8089eea7f19cab1b1e6f3dc4f99f3 Mon Sep 17 00:00:00 2001 From: Ben Rothman Date: Mon, 17 May 2021 17:38:38 -0500 Subject: [PATCH] add callback when existing files are skipped --- Readme.md | 7 +++++++ index.js | 4 ++++ src/helper.js | 1 + 3 files changed, 12 insertions(+) diff --git a/Readme.md b/Readme.md index 558b1b2..101ae64 100644 --- a/Readme.md +++ b/Readme.md @@ -364,6 +364,13 @@ Type: `function` This function gets called with the S3 keyname as the first parameter if the uploaded file is a new file in the bucket, much like `onChange`. +##### onSkippedExisting + +Type: `function` + +This function gets called with the S3 keyname as the first parameter if the file was skipped because `uploadNewFilesOnly` is set to `true` and a different file with the same name exists on S3. + + #### uploadNewFilesOnly Type: `boolean` diff --git a/index.js b/index.js index af6397b..d769a0a 100644 --- a/index.js +++ b/index.js @@ -259,6 +259,10 @@ gulpPrefixer = function (AWS) { } else { fancyLog(colors.gray("Skipping Upload of Existing File ..... "), keyname); + if (options.onSkippedExisting && typeof options.onSkippedExisting === 'function') { + options.onSkippedExisting.call(this, keyname); + } + callback(null); } diff --git a/src/helper.js b/src/helper.js index e8a53c8..725a91c 100644 --- a/src/helper.js +++ b/src/helper.js @@ -27,6 +27,7 @@ module.exports = { 'onChange', 'onNoChange', 'onNew', + 'onSkippedExisting', 'uploadNewFilesOnly', 'verbose' ];