I looked into this a bit further. Unfortunately busboy won't help you as it only handles multipart/form-data bodies. However dicer could easily do the trick for parsing requests.
However, if you need to generate a payload against this API, maybe partly [1] can help you. https://www.npmjs.org/package/partly On Monday, 7 April 2014 09:47:47 UTC+2, Floby wrote: > > Hello, this is an interesting use case. > > Maybe looking at how http2 works https://www.npmjs.org/package/http2 can > help you. It's basically the same principle: several responses multiplexed > into a single connection. Only the framing differs (multipart vs. http2) > > Alternatively, you could try and instanciate yourself a > http.IncomingMessage (response object) [1] whose constructor only takes a > "socket" parameter for which a readable stream should suffice. You may have > to trick the IncomingMessage into thinking the stream is a socket. > > I'd be interested in knowing if that works out. > > > > [1] https://github.com/joyent/node/blob/master/lib/_http_incoming.js > > On Monday, 7 April 2014 03:26:24 UTC+2, Hendrik Cech wrote: >> >> Hey, >> >> 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) { … }) >> }) >> >> Each part of the response is a valid http response in itself. Is it >> therefore possible to use the core http module to parse the individual >> parts? >> I'm not too eager to reimplement a http parser. Unfortunately I haven't >> found a module for that job either. >> >> Thanks, >> Hendrik >> > -- -- 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.
