node.js - How do I read from a highland stream? -
so have highland stream:
var getdata = highland.wrapcallback(fs.readfile); var filestream = getdata('myfile') console.log(filestream)
how read filestream
? according the highland docs, there no read()
method on streams.
you need cause 'thunk' - can done using .each()
, .toarray()
or .apply()
pull data out of stream. say, can use .pull()
to read 1 value stream. .collect()
not cause thunk, batch data once read itself, if want .collect()
forcing read you'll want use .toarray()
.
Comments
Post a Comment