mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-13 11:12:47 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
13
node_modules/needle/examples/download-to-file.js
generated
vendored
Normal file
13
node_modules/needle/examples/download-to-file.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
var fs = require('fs'),
|
||||
needle = require('./..'),
|
||||
path = require('path');
|
||||
|
||||
var url = process.argv[2] || 'https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png';
|
||||
var file = path.basename(url);
|
||||
|
||||
console.log('Downloading ' + file);
|
||||
|
||||
needle.get(url, { output: file, follow: 3 }, function(err, resp, data){
|
||||
console.log('File saved: ' + process.cwd() + '/' + file);
|
||||
console.log(resp.bytes + ' bytes transferred.');
|
||||
});
|
||||
Reference in New Issue
Block a user