Not sure about this code:
forEach(stream, function (chunk) {
/* insert chunk into database or wait for them all */
})
Classical `each` concept doesn't works in async world, this loop for
example won't
wait when operation of inserting chunk into database will be successfully
(or not) finished.
It will consume memory if for example stream is big and fast and database
it written to slow.
it should be something like:
each(stream, function (chunk, next) {
/* insert chunk into database or wait for them all */
/* and call next() or next(err) when You finish and want next chunk
*/
})
Same with toArray - it will load all data into memory.
--
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