Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get .zip file with Node, unzip it and save it to disk by piping the response body into unzipper
const unzipper = require('unzipper');
const fetch = require('node-fetch')
// get data
fetch('https://example.org/my-archive.zip')
.then(resp => {
return new Promise((res, rej) => {
resp.body
.pipe(unzipper.Extract({ path: '/tmp/my-archive' }))
.on('error', rej)
.on('finish', res);
})
})
.catch(console.error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.