index.js
function uploadLocalFile () {
      localFileCursor += 1
      setImmediate(checkDoMoreWork)
      let fullPath = path.join(localDir, localFileStat.path)
      // ***

      if (getS3Params) {
        getS3Params(fullPath, localFileStat, haveS3Params)
      } else {
        upDownFileParams.s3Params = baseUpDownS3Params
        startUpload()
      }

      function haveS3Params (err, s3Params) {
        if (fatalError) return
        if (err) return handleError(err)

        if (!s3Params) {
          // user has decided to skip this file
          return
        }

        upDownFileParams.s3Params = extend(extend({}, baseUpDownS3Params), s3Params)
        startUpload()
      }

      function startUpload () {
        ee.progressTotal += localFileStat.size
        let fullKey = prefix + localFileStat.s3Path
        upDownFileParams.s3Params.Key = fullKey
        upDownFileParams.localFile = fullPath

        let uploader = self.uploadFile(upDownFileParams)
        let prevAmountDone = 0
        let prevAmountTotal = localFileStat.size
        ee.activeTransfers++
        ee.emit('fileUploadStart', fullPath, fullKey)
        uploader.on('error', handleError)
        uploader.on('progress', function () {
          if (fatalError) return
          let amountDelta = uploader.progressAmount - prevAmountDone
          prevAmountDone = uploader.progressAmount
          ee.progressAmount += amountDelta

          let totalDelta = uploader.progressTotal - prevAmountTotal
          prevAmountTotal = uploader.progressTotal
          ee.progressTotal += totalDelta

          ee.emit('progress')
        })
        uploader.on('end', function () {
          ee.activeTransfers--
          ee.emit('fileUploadEnd', fullPath, fullKey)
          ee.emit('progress')
          checkDoMoreWork()
        })
      }
    }
function uploadLocalFile () {
      localFileCursor += 1
      setImmediate(checkDoMoreWork)
      let fullPath = path.join(localDir, localFileStat.path)
      // ***

      if (getS3Params) {
        getS3Params(fullPath, localFileStat, haveS3Params)
      } else {
        upDownFileParams.s3Params = baseUpDownS3Params
        startUpload()
      }

      function haveS3Params (err, s3Params) {
        if (fatalError) return
        if (err) return handleError(err)

        if (!s3Params) {
          // user has decided to skip this file
          return
        }

        upDownFileParams.s3Params = extend(extend({}, baseUpDownS3Params), s3Params)
        startUpload()
      }

      function startUpload () {
        ee.progressTotal += localFileStat.size
        let fullKey = prefix + localFileStat.s3Path
        upDownFileParams.s3Params.Key = fullKey
        upDownFileParams.localFile = fullPath

        let uploader = self.uploadFile(upDownFileParams)
        let prevAmountDone = 0
        let prevAmountTotal = localFileStat.size
        ee.activeTransfers++
        ee.emit('fileUploadStart', fullPath, fullKey)
        uploader.on('error', handleError)
        uploader.on('progress', function () {
          if (fatalError) return
          let amountDelta = uploader.progressAmount - prevAmountDone
          prevAmountDone = uploader.progressAmount
          ee.progressAmount += amountDelta

          let totalDelta = uploader.progressTotal - prevAmountTotal
          prevAmountTotal = uploader.progressTotal
          ee.progressTotal += totalDelta

          ee.emit('progress')
        })
        uploader.on('end', function () {
          ee.activeTransfers--
          ee.emit('fileUploadEnd', fullPath, fullKey)
          ee.emit('progress')
          checkDoMoreWork()
        })
      }
    }
function createRevison() { //use generatior generate().then((res)=> { fs.copyFile(path.join(__dirname, '../../build/index.html'), path.join(__dirname, '../../build/index:'+res.revisionKey+'.html'), (err) => { if (err) throw err; console.log(`${res.revisionKey}.html was copied to destination`); }) }) }