binary-csv icon indicating copy to clipboard operation
binary-csv copied to clipboard

data event emits line *and* index of that line

Open rufuspollock opened this issue 12 years ago • 1 comments

At the moment AFAICT (!) I can't get the index of the current line. I'd love something like:

.on('data', function(line, index) {... }

This is useful in a whole bunch of situations. Would it be possible to add - e.g. i'm implementing a head operator for a csv in https://github.com/okfn/datapipes

rufuspollock avatar Jan 09 '14 21:01 rufuspollock

you can implement another stream that does fancy stuff and then pipe binary-csv into that, e.g.

https://npmjs.org/package/head-stream

or you could write a simple stream that gives you objects with the index and the buffer of everything written into it

max-mapper avatar Jan 09 '14 22:01 max-mapper