Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Created Apr 22, 2021
Embed
What would you like to do?
// https://ballpit.github.io/website/pics.zip
const fs = require('fs')
const get = require('simple-get')
const pump = require('pump')
const path = require('path')
get('https://ballpit.github.io/website/pics.zip', (err, res) => {
if (err) throw err
const outStream = fs.createWriteStream(path.join(__dirname, 'pics.zip'))
pump(res, outStream, (err) => {
if (err) throw err
console.log('done')
})
})
{
"name": "download-example",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Bret Comnes <bcomnes@gmail.com> (https://bret.io/)",
"license": "MIT",
"dependencies": {
"pump": "^3.0.0",
"simple-get": "^4.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment