Closed samjross closed 3 years ago
Set a flag variable and just don't process any data as an alternative. Read up on Node streams to understand more on how streams work. You can close a stream in the data
handler, but you're not guaranteed not to receive any more data
events because streams are async.
This is not a documentation issue with csv-parser.
Documentation Is:
Please Explain in Detail...
this stackoverflow question has the asker using
stream.unpipe(csv());
to close the stream if he's finished with it in the middle of the process, before it's done reading the rest of the file. I came to the npm docs to find out what the proper way is to close a stream and couldn't find any clarity on the question.Your Proposal for Changes
Produce an example for closing the stream, like so: