Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to write stream chunk by chunk with callbacks
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mikeal Rogers  
View profile  
 More options Oct 13 2012, 4:33 pm
From: Mikeal Rogers <mikeal.rog...@gmail.com>
Date: Sat, 13 Oct 2012 22:33:00 +0200
Subject: Re: [nodejs] Re: How to write stream chunk by chunk with callbacks

i'm not engaging with your strawman Bruno.

i showed how we *actually* move data in node. this is not a debate, that's how it works. if anyone wants to use node, or write a module that has a stream that moves data, that's how they do it.

this was a question, not an open invitation for bikeshedding. please let the list answer questions.

On Oct 13, 2012, at October 13, 20128:04 PM, Bruno Jouhier <bjouh...@gmail.com> wrote:

> What's wrong?

> You'll find links to gists at the end of my post. The code works!
> And Alexey's pumping function is equivalent to the pumping loop I gave in my post.

> On Saturday, October 13, 2012 7:31:54 PM UTC+2, Mikeal Rogers wrote:
> all of these are wrong.

> inputStream.pipe(outputStream)
> outputStream.on('close', callback)

> On Oct 13, 2012, at October 13, 20127:23 PM, Bruno Jouhier <bjou...@gmail.com> wrote:

>> I wrote a post about plain callback APIs for streams: http://bjouhier.wordpress.com/2012/07/04/node-js-stream-api-events-or...

>> On Saturday, October 13, 2012 11:17:13 AM UTC+2, Alexey Petrushin wrote:
>> 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 nod...@googlegroups.com
>> To unsubscribe from this group, send email to
>> nodejs+un...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en

> --
> 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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.