I implemented a streaming readdir for vfs that stats each file and streams
data events with objects as values.  I use this encoder to convert the
object events to json bytes.

Also this stream supports pause and resume so that it can be piped with
proper backpressure.

https://github.com/c9/vfs/blob/master/local/localfs.js#L575 - vfs.readdir()
https://github.com/c9/vfs/blob/master/http-adapter/restful.js#L9-43
 jsonEncoder()


On Fri, Jul 6, 2012 at 8:40 AM, Julian Gruber <misterio...@googlemail.com>wrote:

> Thanks, that looks perfect!
>
>
> On Friday, July 6, 2012 2:55:26 PM UTC+2, José F. Romaniello wrote:
>>
>> Yes, i think Fstream emits an Entry event per each file with the stat and
>> also each Entry is an stream of the file
>>
>> El viernes, 6 de julio de 2012, Ben Noordhuis escribió:
>>
>>> On Fri, Jul 6, 2012 at 2:28 PM, Julian Gruber
>>> <misterio...@googlemail.com> wrote:
>>> > Is it possible to create a readStream from readDir? I tried
>>> > createReadStream('.') but directories are not supported there.
>>> >
>>> > Generally, is it possible to build on streams completely for control
>>> flow,
>>> > having as few callbacks as possible?
>>>
>>> Not really. Streams are byte or character oriented, a
>>> DirectoryReadStream would be record oriented.
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-*
>>> *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 nodejs@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> nodejs+unsubscribe@**googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<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 nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> 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 nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to