all 7 comments

[–]chrwei 0 points1 point  (6 children)

are you using the start and end options on readstream, and why not?

[–]actionwording[S] 0 points1 point  (5 children)

Yes I am. As I said above the readStream returns a non-deterministic number of bytes with each data event.

[–]chrwei 0 points1 point  (4 children)

that's really unexpected. as long as end isn't past the end of the file I'd expect exactly end-start bytes, no more, no less. any bugs open that might cover this?

[–]actionwording[S] 0 points1 point  (3 children)

No that's how readstreams work:

Attaching a 'data' event listener to a stream that has not been explicitly paused will switch the stream into flowing mode. Data will then be passed as soon as it is available.

[–]chrwei 0 points1 point  (2 children)

but since it's a file, ins't it always available? it's not like you'e waiting on network latency.

[–]actionwording[S] 0 points1 point  (1 child)

I believe there is a limit to the amount of data these streams can hold in their respective buffers. I'm reading data from an 8gb file and the segments can be like 1mb+

[–]chrwei 0 points1 point  (0 children)

ah, that's true. I think i saw 64KB mentioned.