Monday 11 April 2016

How can I make writes to a stream separate 'data' events?

I'm piping output from one file into the input of another. How can I control how the buffers are delimited? I want to ensure that separate 'data' events are triggered on the receiving end's input stream.In outputting.coffee I have:q = require 'q' q.fcall process.stdout.write('1,2', 'utf8') .then process.stdout.write('3,4', 'utf8') In receiving.coffee I have:process.stdin.on 'data', (data)-> console.log "A single chunk: " + data Then I pipe them together in the commandline, with coffee outputting.coffee | coffee receiving.coffeeHowever, as output I get A single chunk: 1,23,4How can I make sure these writes are separate data events?

Submitted April 11, 2016 at 04:55PM by Yamochao

No comments:

Post a Comment