Coder Social home page Coder Social logo

node-zipper's Introduction

Zipper

Zipper is a tiny nodejs app, which takes a URL pointing to a json file that lists files (URLs) you want to generate a zipfile for while streaming it to your client.

Use case

Say, you want to provide your users a way to download a number of files, e.g. large images or arbitrary blobs. You can implement this by generating a zipfile in background workers, upload it to e.g. S3 and point the user to this uploaded file. However, if the zip is comprised of many large files, your workers will be blocked for a long time and the user has to wait for the actual upload before he/she can start downloading the file. Streaming the zipfile from within your frontend is probably not possible as well, due to timeouts, memory issues, missing streaming support, etc. Using zipper, you can offload the zip file generation and streaming from your app, by a) uploading a multiline json file to e.g. http://url.to/file.json:

{ filename: "filename1.jpg", url: "http://url.to/filename1.jpg" }
{ filename: "filename2.jpg", url: "http://url.to/filename2.jpg" }
...

and b) redirecting the user to zipper while pointing to the uploaded file:

http://zipper.host:8080/generate?signature=SIGNATURE&url=http://url.to/file.json&filename=file.zip

Zipper will then download the file, download the listed files one after another while generating a zip file and stream it to the user as file.zip.

Installation

$ npm install
$ PORT=8080 BIND=0.0.0.0 TOKEN=SECRET_TOKEN node app.js

Signature

The signature is build and checked via sha256(token + ":" filename + ":" + url)

node-zipper's People

Contributors

mrkamel avatar

Watchers

 avatar James Cloos avatar Tobias Kneuker avatar  avatar Florian Gubernator avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.