Open 1mike12 opened 7 months ago
I'm no stream expert
heh, me neither :sweat_smile:. uDSV's api is fully synchronous, so there shouldn't be any surprises there.
does this reproduce with something you can attach here and i can debug (that hopefully isnt 16M records)?
yeah for sure, I just created a example repo you can use to run everything. just run example.ts I plopped in some random csv I found online, but really, any CSV will work to repro this issue it seems like
https://github.com/1mike12/usdv-stream-example
But regarding the api, I think the way to get it to work with streams is to use the chunk function, which seems to be async right now. I imagine it should be able to be synchronous though too though, since there shouldn't be a reason for the parser to not be able to give us what it's already got so far in a sync way?
this.parser.chunk<string[]>(strChunk, this.parser.stringArrs, (parsedData) => {
this.push(parsedData);
callback()
});
But either way, whether its sync or async, it really doesn't matter to a Transform stream, which is why I'm so confused why it just stops and ends so soon
You should see something like
██████████████████████████████ 100% 1.4 / 1.4 MB 0.0s 36.1MB/s
███░░░░░░░░░░░░░░░░░░░░░░░░░░░ 9% 128.0 / 1.4 MB 0.0s 62.5MB/s
Process finished with exit code 0
just heads up, it might be week or so before i can get to testing this.
I'm no stream expert, but given the examples, it seemed like it would be super easy to create a transform stream with your module.
I am able to verify that it works fine when running like the example in the readme, but when I port it into a custom Transform stream, it ends super early, doesn't hit the writeable, and I get no errors. There's a good chance this isn't a problem with uDSV, but it's strange, given your apis, this should work.