Skip to content

Commit

Permalink
create trivia dir if not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
ayan4m1 committed Apr 17, 2024
1 parent 2b04609 commit 2e007fd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion split.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Papa from 'papaparse';
import { createReadStream } from 'fs';
import { writeFile } from 'fs/promises';
import { writeFile, mkdir } from 'fs/promises';
import { pick } from 'lodash-es';

const inputStream = createReadStream('./questions.csv');
Expand All @@ -23,6 +23,9 @@ Papa.parse(inputStream, {
);
}

await mkdir('./trivia/shows', {
recursive: true
});
for (const [showNumber, questions] of shows.entries()) {
await writeFile(
`./trivia/shows/${showNumber}.json`,
Expand Down

0 comments on commit 2e007fd

Please sign in to comment.