fetchFromS3 = async paths =>
  await Promise.all(
    paths.map(async path => {
      if (path.endsWith('.json')) {
        const response = await fetch(`${PREFIX}/${path}`);
        return await response.json();
      } else if (path.endsWith('.csv')) {
        // parsePromise is a promise wraper over the loadCsvFileWithoutWorker function
        const response = await parsePromise(`${PREFIX}/${path}`);
        return await response.data;
      } else if (path.endsWith('.arrow')) {
        const file = await fetch(`${PREFIX}/${path}`);
        const response = await parseArrow(file);
        return response;
      }
      /* eslint-disable no-console */
      console.warn(`${path} file format not supported.`);
      /* eslint-enable no-console */
    })
  )
a utility function that loads a list of files from S3, asynchronously
currently, only .json, .csv and .arrow files are supported.

example usage:
  fetchFromS3([
    'graphvis/tsne.json',
    'graphvis/graph.json',
    'graphvis/speeds.json',
  ]).then(([embedding, graph, speed]) => {
     // use the loaded data here
  });

@param {array} paths: a list file paths on S3
@return an array of promises with data loaded from the specified paths