Thanks @Dominic for your concise answers. Exactly what I needed. On Wednesday, August 1, 2012 1:54:35 AM UTC-7, Dominic wrote: > > A1) you need to assign a listener _before_ nextTick. > > A2) you only need to call destroy() if you've decided to end the stream > early. > streams must cleanup after they have emitted 'end', (or you have called > end() > and they are only a writable stream) > > On Wed, Aug 1, 2012 at 6:45 AM, Carlos <[email protected]> wrote: > > Question 1 > > > > When I read things like "data will be lost if there is no listener when > a > > Readable Stream emits a 'data' event," it's pretty obvious that I need > to > > have a listener attached before the stream is capable of emitting > events. > > How can I guarantee this? Said another way, what is the earliest point > in > > one-and-only js thread and/or the event-loop when a stream can emit an > > event? > > > > I am looking at this from two sides. On one side, I need to make sure I > > don't miss any data events. On the other side, I don't want to > accidentally > > create blocking code by doing something which would delay the data > events. > > > > Question 2 > > > > If I create a steam indirectly, such as with fs.create ReadStream(...) > who > > is responsible for releasing the file descriptor (or other resources)? > > Should I call destory() on the stream or not? > > > > Thanks! > > > > -- > > 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
