Skip to content

Instantly share code, notes, and snippets.

@oguzcan-yavuz
Created August 7, 2018 11:12
Show Gist options
  • Save oguzcan-yavuz/6a7bd06699226f92e24cb6999c2e8803 to your computer and use it in GitHub Desktop.
Save oguzcan-yavuz/6a7bd06699226f92e24cb6999c2e8803 to your computer and use it in GitHub Desktop.
node download example
// https://stackoverflow.com/questions/12740659/downloading-images-with-node-js
const fs = require('fs'),
request = require('request')
function download(uri, filename, callback){
request(uri).pipe(fs.createWriteStream(filename)).on('close', callback)
}
download('https://www.google.com/images/srpr/logo3w.png', 'google.png', function(){
console.log('done')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment