const chalk = require('chalk');
/**
 *
 * @param {*} uploader
 */
function promiseWrapUploader(uploader) {
  return new Promise(function (resolve, reject) {
    uploader.on('error', reject);
    uploader.on('end', resolve);
    uploader.on('fileUploadEnd', function (localFilePath, s3Key) {
      console.log(`Pushed ${chalk.default.yellow(localFilePath)} to ${chalk.default.yellow(s3Key)}`);
    });
  });
}

module.exports = promiseWrapUploader;
