lib/deployer.js
async function _uploadFiles(dir, presignedPosts) {
  const promises = [];
  const limit = pLimit(5);
  let uploaded = false;

  Object.keys(presignedPosts).forEach(async (path) => {
    const { post } = presignedPosts[path];

    if (!post) {
      Logger.tagged('exists', path, 'blue');
    } else {
      const filePath = resolve(dir, path);
      const form = new FormData();

      Utils.forEach(post.fields, (value, key) => { form.append(key, value); });
      form.append('file', fs.createReadStream(filePath));

      const promise = limit(() => got.post(post.url, { body: form }).then(() => {
        Logger.tagged('upload', path);
      }));

      promises.push(promise);
      uploaded = true;
    }
  });

  await Promise.all(promises);
  return uploaded;
}
async function _uploadFiles(dir, presignedPosts) {
  const promises = [];
  const limit = pLimit(5);
  let uploaded = false;

  Object.keys(presignedPosts).forEach(async (path) => {
    const { post } = presignedPosts[path];

    if (!post) {
      Logger.tagged('exists', path, 'blue');
    } else {
      const filePath = resolve(dir, path);
      const form = new FormData();

      Utils.forEach(post.fields, (value, key) => { form.append(key, value); });
      form.append('file', fs.createReadStream(filePath));

      const promise = limit(() => got.post(post.url, { body: form }).then(() => {
        Logger.tagged('upload', path);
      }));

      promises.push(promise);
      uploaded = true;
    }
  });

  await Promise.all(promises);
  return uploaded;
}
async function _uploadFiles ( dir , presignedPosts ) { const promises = [ ] ; const limit = pLimit ( 5 ) ; let uploaded = false ; Object . keys ( presignedPosts ) . forEach ( async ( path ) => { const { post } = presignedPosts [ path ] ; if ( ! post ) { Logger . tagged ( 'exists' , path , 'blue' ) ; } else { const filePath = resolve ( dir , path ) ; const form = new FormData ( ) ; Utils . forEach ( post . fields , ( value , key ) => { form . append ( key , value ) ; } ) ; form . append ( 'file' , fs . createReadStream ( filePath ) ) ; const promise = limit ( ( ) => got . post ( post . url , { body : form } ) . then ( ( ) => { Logger . tagged ( 'upload' , path ) ; } ) ) ; promises . push ( promise ) ; uploaded = true ; } } ) ; await Promise . all ( promises ) ; return uploaded ; }
Upload files to S3

@param {Object} paths
@param {Object} presignedPosts
Upload files to S3