Skip to content

Instantly share code, notes, and snippets.

@justsml
Last active December 14, 2018 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justsml/db5ccc55ffb93c75e04e014d1f553cfb to your computer and use it in GitHub Desktop.
Save justsml/db5ccc55ffb93c75e04e014d1f553cfb to your computer and use it in GitHub Desktop.
const progressHelper = require('./progressHelper.js')
const handler = ({loaded, total}) => {
console.log(`Downloaded ${loaded} of ${total}`)
}
// handler args: ({ loaded = Kb, total = 0-100% })
const streamProcessor = progressHelper(handler)
// => streamProcessor is a function for use with the response _stream_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment