Last Updated: December 26, 2018
·
7.541K
· sebastianhoitz

Node.JS on-the-fly streaming of zip files as download

Using this small class, you can create on-the-fly zip files, pipe multiple files into it while streaming the download to the client:

https://gist.github.com/4554903

This provides multiple advantages:

  • No need to create the zip file first
  • Save hard disk space, since everything is immediately streamed
  • Better and more reactive user experience

This was inspired by: http://blog.dump.ly/post/19819897856/why-node-js-streams-are-awesome