[nodejs] Re: Should I use asynchronous callbacks for non-I/O tasks?

2013-04-09 Thread Sigurgeir Jonsson
As javascript is single threaded you usually don't need callback unless it's IO related. However, there are exceptions: (i) Heavy calculations might want to utilize process.nextTick() or timeout, to avoid blocking. You would have to use a callback to return the final results (ii)

[nodejs] Re: Should I use asynchronous callbacks for non-I/O tasks?

2013-04-09 Thread Sigurgeir Jonsson
As javascript is single threaded you usually don't need callback unless it's IO related. However, there are exceptions: (i) Heavy calculations might want to utilize process.nextTick() or timeout, to avoid blocking. You would have to use a callback to return the final results (ii)

[nodejs] Re: Steams2: It ain't over till it's over

2013-04-08 Thread Sigurgeir Jonsson
for more information. On Monday, April 8, 2013 6:51:54 PM UTC-4, Floby wrote: It's funny because I have made a joiner stream here at http://github.com/Floby/node-stream-stream On Monday, 8 April 2013 03:00:28 UTC+2, Sigurgeir Jonsson wrote: When piping multiple streams into one stream

[nodejs] Steams2: It ain't over till it's over

2013-04-07 Thread Sigurgeir Jonsson
When piping multiple streams into one stream (terminal stream) an end-event from any of the inputs seems to immediately result in a finish event of the terminal stream. Would it not make sense to keep count of incoming pipes that have been defined, and only emit finish when ALL incoming streams

[nodejs] stream.Writable highWaterMark

2013-04-04 Thread Sigurgeir Jonsson
Would it make sense to amend stream.Writable so that highWaterMark stands for the maximum number of write-operations (callbacks) outstanding at each point? Currently, it seems that stream.Writable is stuck in sequential mode, i.e. only one write operation can be outstanding at any given point,

Re: [nodejs] stream.Writable highWaterMark

2013-04-04 Thread Sigurgeir Jonsson
not be shoehorned into the Stream shape, imo. On Thu, Apr 4, 2013 at 10:24 AM, Sigurgeir Jonsson ziggy.jo...@gmail.com javascript: wrote: Would it make sense to amend stream.Writable so that highWaterMark stands for the maximum number of write-operations (callbacks) outstanding

[nodejs] Re: New Streams confusion

2013-03-21 Thread Sigurgeir Jonsson
well. If you were writing a library for a special parser, you might write a custom Writable stream and inside it you would be using the read(n) api to control *how* you read data off the socket. I hope that makes sense. :Marco On Monday, March 18, 2013 11:06:48 AM UTC-7, Sigurgeir Jonsson