News for hackers. Stuff that matters.
Re:Node.js Stream Playground by marknadal on Friday November 15, 2013 @01:54PM (#6741352)
Anybody know how to dynamically zip things on the fly? Like if you want to generate a download for a user that has files and folders... how can you do this fast and in one go? Currently I have to literally write to disk, then zip it, and only then can I finally send a response. Any help?
Re:Node.js Stream Playground by jeresig on Friday November 15, 2013 @02:02PM (#6741398)
Absolutely! Poking around I found one module that could do it - I'm sure there are more (and better ones, too): https://github.com/wellawaretech/node-zipstream

In the example there you would .pipe() out to an HTTP response rather than a file, presumably.

Re:Node.js Stream Playground by marknadal on Friday November 15, 2013 @02:13PM (#6741454)
Sweet, thanks. I think I had found this a while ago but lost it, looks great!

...holy smokes, John Resig just replied to me. Thanks so much for jQuery, it has changed my life and is what made me become a programmer. (I now do client work for 20<20Thiel Fellows, and my startup has been in WSJ - none of which would have been the case if I hadn't started programming with jQuery!)

Re:Node.js Stream Playground by maxogden on Friday November 15, 2013 @05:54PM (#6742702)
for an example of doing this with tar instead of zip check out https://npmjs.org/package/dir-tar-stream
Re:Node.js Stream Playground by contrahax on Saturday November 16, 2013 @12:09AM (#6743720)
node-archiver is the best ive used so far... imo