I am reading a large JSON file using JSONStream and I want to call a method when the whole stream is processed.
var JSONStream = require('JSONStream'), es = require('event-stream');
es.pipeline(
fs.createReadStream('file.json'),
JSONStream.parse(['features', true]),
es.map(function (data) {
console.log("Added data");
})
);
How can I do that?
Sorted. Save the read stream in a variable and pipe an on(‘end’, function) on that read stream.