nef
nef
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
thank you for the help though, I'll look into moving my project to deno
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
they're classified as "stable" haha
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
the type inference also vanished, entry used to be Record<string, string> and now it's any
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
that still works, but this time the error has moved to the iteration
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);
}
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);
}
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
is there some tsconfig setting that would help?
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
I am tempted to switch from node to deno, but last time (a month ago) I had a bunch of issues with the lsp in neovim...
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
I'm looking into this again and got it working, but typescript is complaining about the types:
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 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 }));
ts: 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]
ts: 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]
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
oooh that looks like it, thank you!
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
I'm still interested if it's possible but for now I'm using npm's csv-parse
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
yeah sorry I'm trying to use the libraries from node.js with jsr's node compatibility
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
I'm sure loading to a string is possible, but the file is fairly big
20 replies
DDeno
Created by nef on 5/8/2025 in #help
Possible to use CsvParseStream in Node.js
as far as I can tell there's nothing in @std/path or @std/fs that opens a file
20 replies