This commit is contained in:
lilyissillyyy
2026-01-06 17:30:50 -05:00
parent f09f3956ec
commit 25b0189131
+3 -3
View File
@@ -76,15 +76,15 @@ module.exports = class JeopardyScrape {
this.seasons = seasons;
this.clues = await this.importClues();
this.imported = true;
return file;
return this;
}
importClues() {
const pipeline = fs.createReadStream(path.join(__dirname, '..', 'jeopardy.json'), { encoding: 'utf8'})
const pipeline = fs.createReadStream(path.join(__dirname, '..', 'jeopardy.json'), { encoding: 'utf8' })
.pipe(parser())
.pipe(pick({ filter: 'clues' }))
.pipe(streamArray());
pipeline.on('data', ({ key, value }) => this.clues.push(value));
pipeline.on('data', ({ value }) => this.clues.push(value));
return new Promise(res => {
pipeline.on('end', () => res(this.clues));
});