1. all streams are EventEmitter instances, and this is mentioned on the
docs first. so everything works for stremas as well including 'error'. just
attach a listener on 'error' and you're safe.
2. both ways work. you could subclass or just create a Writabel instance
and attach a new _write function. It's more a matter of style and applied
paradigm. some prefer the mixin-approach, some inheritance. me personally
prefer the mixin approach, because it's cleaner and more focused on actual
work, than pseudoclass-boilerplating.
Am Sonntag, 7. April 2013 21:02:04 UTC+2 schrieb Liam:
>
> The v0.10 docs don't mention an 'error' event for Stream.Writable. Is that
> a docs omission, or an API change?
>
> Stream.Writable#write() takes a callback that provides an error, but the
> callback is described as 'optional'. If errors were only reported this way,
> surely it wouldn't be optional?
>
> Also, the docs don't give an example of defining a custom Stream.Writable.
> Should we define a subclass formally, or simply:
>
> var s = new Stream.Writable()
> s._write = function(...) {} // feels odd; I'm used to attaching functions
> to prototypes
>
>
--
--
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.