Unfortunatelly the objectMode doesn'T mean "any kind of object", so you 
can't use it to stream anything than Buffer or String instances. This mode 
in fact a "i won't concat the chunks to one big, but let them as you push 
them".  This mode is good for some cases e.g. when you parse something and 
want return well delimited tokens, as lines or xml-tags. But still it 
handles just binary or string data. So i assume the watermarks are working 
just the same as before. If you want to us real object streams, look into 
https://github.com/dominictarr/event-stream

Am Sonntag, 20. Oktober 2013 05:18:28 UTC+2 schrieb Chaoran Yang:
>
> Hi all,
>
> I'm trying to implement a stream in object mode. It's a very complex 
> stream that allows user read and write database records. But for this 
> discussion, you can just imagine it as a duplex stream that reads and 
> writes database records in a table.
>
> [Question] I've read the API doc on streams. It's a bit unclear about the 
> usage of highWaterMark in object mode. Does it limit the number of objects 
> that it internally buffered? If not, how do I control the memory usage of 
> the internal buffer?
>
> [Suggestion] The API doc said "a readable stream in object mode will 
> always return a single item from a call to readable.read(size), regardless 
> of what the size argument is", which feels very unintuitive for me. I think 
> it should be more intuitive if readable.read(size) returns "size" items.
>
> [Suggestion] Currently, The special value null still retains its special 
> value for object mode streams. That is, for object mode readable streams, 
> null as a return value from stream.read() indicates that there is no more 
> data, and stream.push(null) will signal the end of stream data (EOF). 
> However, in the stream I want to implement, a null object is exactly what I 
> want to return to the consumer, and it should not indicate that there is no 
> more data. Wouldn't it be more appropriate to use "undefined" as the 
> special value to indicate the end of stream data?
>
> Thanks,
> Chaoran Yang
>

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

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to