Nodejs Filestream Concurrency
it looks to me like I have a concurrency problem in nodejs. I am aware of the fact that this is not supposed to be possible. I am processing data by the line from a file and writin
Solution 1:
This appears to be a buffer overflow issue. You are likely overflowing the write buffer, but not paying any attention to flow control.
You can either pass a callback into .write()
and only proceed with the next write when that callback is called or you can pay attention to the return value from .write()
and when it returns false
, you have to then wait for the drain
event on the stream before writing some more.
Another approach would be to write a transform stream and then use .pipe()
and let the streaming infrastructure manage the flow control for you.
Post a Comment for "Nodejs Filestream Concurrency"