Skip to content

Commit

Permalink
Process Download URLS for worker to parse and create Issues from in Fork
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobMGEvans committed Sep 29, 2021
1 parent 7af84e6 commit 0d2e971
Show file tree
Hide file tree
Showing 3 changed files with 2,469 additions and 137 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const rawResponse = await octokit.repos.getContent({ owner: 'OpenSourceRaidGuild
const { data: allRefs } = rawResponse;

// Get the download URLS for each file at that path
const downloadUrls = allRefs.map(ref => ref.download_url);
const downloadURLs = allRefs.map(ref => ref.download_url);

// Get the contents of those files
let rawFileContents = await fetch(downloadUrls[1]);
let fileContents = rawFileContents.body;

const rawFileContents = downloadURLs.map(async url => await (await fetch(url)));
// settle array of Promises for rawFileContents
const settlePromisesFiles = await Promise.all(rawFileContents);
const fileContents = settlePromisesFiles.map(rawFile => rawFile.body)

console.log(fileContents)
return new Response(fileContents, {
headers: { 'Content-Type': 'application/json' },
})
Expand Down
Loading

0 comments on commit 0d2e971

Please sign in to comment.