Pausing a stream
See original GitHub issuePausing a stream() doesn’t seem to have an effect - The parser proceeds reading the CSV as usual.
Take for example the following code:
const rs = fs.createReadStream(this.csvPath);
rs.pause();
let count = 0;
csv()
.fromStream(rs)
.on("json", (json) => {
count++;
console.log(count);
})
.on("done", () => {
cb(null, count);
})
.on("error", (err) => {
cb(err);
})
count is logged 200 times (equal to the amount of rows in the CSV) - I was expecting it not to log anything since the stream is paused before passing it over to fromStream()
Issue Analytics
- State:
- Created 7 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Pause a stream | Datastream | Google Cloud
Go to the Streams page in the Google Cloud Console. Go to the Streams page · Select the check box to the left...
Read more >Can a Livestream Be Paused? - Camera Groove
Surely there's a way of pausing the live stream? ... Yes, a Livestream can be paused by pressing the 'pause' button within the...
Read more >Does pausing a video help or hinder the buffering process?
Its is not possible to pause a live video, you can take an image and picture it on the profile so its appears...
Read more >What is Stream Module pause() in Node.js? - Educative.io
We can use the readable.pause() method to stop the flow of data events. This method pauses the reading of data from a file....
Read more >14.11. Pausing and Resuming a Net Stream - O'Reilly
You can use the NetStream.pause( ) method to pause the playback of a net stream. For example, if a net stream is playing,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

😄 As mentioned before, this is not correct way of doing things.
Node.js has encapsulated this in its stream implementation and we should not need to do this.
Implement your own Writable implementation is the correct way of doing this. see https://nodejs.org/api/stream.html#stream_simplified_construction
here is an example of what you want to achieve:
~Keyang
On 23 January 2017 at 14:41, Nicholas Kyriakides notifications@github.com wrote:
Nice - that looks much cleaner. Thanks again.