I don't quite understand how steam pause/resume works, or more exactly - how to use it in simple manner. It's necessary to use it in situations when the read stream produces data faster than the write stream can consume.
I need to write custom stream implementation and writing it with proper handling of `pause/resume` functionality seems not a very easy task. Plain callbacks seems simpler to me, can streams be somehow wrapped into a code like that ( code with highlighting https://gist.github.com/3883920 ) ? var copy = function(inputStream, outputStream, callback){ var copyNextChunk = function(){ inputStream.read(fuction(err, chunk){ if(err) return callback(err) // When chunk == null there's no data, copying is finished. if(!chunk) return callback() outputStream.write(chunk, function(err){ // Callback called only when chunk of data // delivered to the recipient and // we can send another one. if(err) return callback(err) copyNextChunk() }) }) } } -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
