Maybe you can have a look at https://github.com/chaosim/peasy, which is a simple parser, or a simple method to write a parser. peasy is not based on stream, maybe you can write yourself a parser based on stream by using the method that peasy has demonstrated.
在 2014年4月7日星期一UTC+8下午12时22分18秒,Hendrik Cech写道: > > Dicer looks great, thank you. > The bigger problem still remains: I need to parse the parts contents. > They are http responses themselves. > > 2014-04-07 16:00 GMT+12:00 mscdex <[email protected] <javascript:>>: > > On Sunday, April 6, 2014 9:26:24 PM UTC-4, Hendrik Cech wrote: > >> > >> I'm currently trying to make multipart/mixed requests and parse the > >> responses. The format is explained here: > >> https://developers.google.com/storage/docs/json_api/v1/how-tos/batch > >> Implementing the body generator for the request wasn't too hard. Now > I'm > >> thinking about how to write a streaming response parser. > >> I would like to have an api similar to this: > >> > >> http.request(opts, function(res) { > >> var parser = new Parser() > >> res.pipe(parser) > >> parser.on('part', function(part) { ... }) > >> }) > >> > > > > There's dicer[1], which powers busboy[2]. > > > > [1] https://github.com/mscdex/dicer > > [2] https://github.com/mscdex/busboy > > > > -- > > -- > > 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]<javascript:> > > To unsubscribe from this group, send email to > > [email protected] <javascript:> > > 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 a topic in the > > Google Groups "nodejs" group. > > To unsubscribe from this topic, visit > > https://groups.google.com/d/topic/nodejs/-IMTql2_NTU/unsubscribe. > > To unsubscribe from this group and all its topics, send an email to > > [email protected] <javascript:>. > > For more options, visit https://groups.google.com/d/optout. > -- -- 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/d/optout.
