I tend to agree.

The current implementation in most of node allows setEncoding to change the 
data event to emit buffers. In the case of several userland streams strings are 
emitted.

For efficiency, if people are expected to work with the data as a string it is 
much cheaper to avoid unnecessary conversions, but IMO it's painful to not be 
able to assume "data" events will be Buffers.

-Mikeal

On Sep 3, 2012, at September 3, 20128:26 PM, tjholowaychuk 
<[email protected]> wrote:

> IMO if the idea behind streams are to act like pipes then "data" events 
> should only be "raw" data aka Buffers (strings too I guess),
> if it's a non-stream then whatever I guess
> 
> On Monday, 3 September 2012 15:44:55 UTC-7, Mike Nichols wrote:
> When issuing a redis command which expects a multi-bulk reply but the key 
> does not exist, one may receive the following:
> +OK
> *0
> 
> The redis docs say "If the specified key does not exist, the key is 
> considered to hold an empty list and the value 0 is sent as multi bulk count."
> 
> It seems like it is proper to emit a 'data' event in a client library with 
> the 'empty list' redis implies so that consuming code can use it in a 
> pipeline and let the consumer handle the `empty list` there.
> 
> This came from looking at 'https://github.com/tblobaum/redis-stream' where 
> this sort of reply drops the data, thus breaking the pipeline. 
> 
> This leads me to the greater question on whether or not to emit 'data' for a 
> empty value. My gut says low level libs like these _should_ emit the event 
> with empty data but I wonder what other authors are preferring.
> 
> Any opinions would be appreciated on this.
> 
> 
> -- 
> 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

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