This is a question about recommended usage in Node.
As an example, let's say I want to write a function that returns the
first n prime numbers.
I could write a function that takes n and a callback.
It could invoke the callback once for each prime number to be returned
and then invoke it with zero to signal the end.

I could also write a function that takes n and returns a readable stream.
The caller could listen for data events (one per prime number to be returned)
and an end event.

I'm pretty sure the stream approach is preferred,
but would you say that the callback approach is wrong or at least discouraged?

-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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

Reply via email to