Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Created April 22, 2021 00:11
Show Gist options
  • Save bcomnes/416bd80f7fe9a02e9232988ab4874a01 to your computer and use it in GitHub Desktop.
Save bcomnes/416bd80f7fe9a02e9232988ab4874a01 to your computer and use it in GitHub Desktop.
// 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