source: trip-planner-front/node_modules/needle/examples/stream-to-file.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 360 bytes
Line 
1var fs = require('fs'),
2 needle = require('./..'),
3 path = require('path');
4
5var url = process.argv[2] || 'http://www.google.com/images/errors/robot.png';
6var file = path.basename(url);
7
8console.log('Downloading ' + file + '...');
9needle
10 .get(url)
11 .pipe(fs.createWriteStream(file))
12 .on('done', function() {
13 console.log('Done!')
14 })
Note: See TracBrowser for help on using the repository browser.