Possible to use CsvParseStream in Node.js
Hi, is it possible to use nodejs file streams with deno's stdlib?
any with , so you need to manually override the type:any@std/path@std/fs@std@stdcsv-parsets: Argument of type 'CsvParseStream<{ readonly skipFirstRow: true; }>' is not assignable to parameter of type 'ReadableWritablePair<Record<string, string> | undefined, any>'.
Types of property 'readable' are incompatible.
Type 'ReadableStream<Record<string, string>>' is missing the following properties from type 'ReadableStream<Record<string, string> | undefined>': values, [Symbol.asyncIterator] [2345].toWeb()entryRecord<string, string>import fs from 'node:fs';
import { Readable } from 'node:stream';
import { CsvParseStream } from '@std/csv';
const stream = Readable
.toWeb(fs.createReadStream('./data.csv', 'utf8'))
.pipeThrough(new CsvParseStream({ skipFirstRow: true }));import { CsvParseStream } from "@std/csv";
const source = await Deno.open("./data.csv");
const stream = source.readable
.pipeThrough(new TextDecoderStream())
.pipeThrough(new CsvParseStream({ skipFirstRow: true }));import fs from "node:fs";
import { Readable } from "node:stream";
import { CsvParseStream } from "@std/csv";
const source = Readable.toWeb(fs.createReadStream("./data.csv", "utf8"));
const stream = (source as ReadableStream<string>)
.pipeThrough(new CsvParseStream({ skipFirstRow: true }));import fs from "node:fs";
import { Readable } from "node:stream";
import { CsvParseStream } from "@std/csv";
const source = Readable.toWeb(fs.createReadStream("./data.csv", "utf8"));
const stream = (source as ReadableStream<string>)
.pipeThrough(new CsvParseStream({ skipFirstRow: true }));
// Type 'ReadableStream<Record<string, string>>' must have a '[Symbol.asyncIterator]()' method that returns an async iterator.
for await (const entry of stream) {
if (!entry) continue;
console.log(entry);
}