3 ms·
Also read "stupid" code :) I didn't know about Deno and streams, but this looks fine const file = await Deno.open("huge-quotes.txt"); const quotes: string
by boriselec 1y ago
Also read "stupid" code :)
I didn't know about Deno and streams, but this looks fine
const file = await Deno.open("huge-quotes.txt");
const quotes: string[] = [];
await file.readable
.pipeThrough(new TextDecoderStream())
.pipeThrough(new TextLineStream())
.pipeTo(new WritableStream({
write(line) {
quotes.push(line);
}
}));
- brabel 1y agoLooks like straight out of Dart.