Unit_AI/node_modules/fetch/example/pipe.js
2024-06-01 16:24:36 -04:00

16 lines
292 B
JavaScript

'use strict';
// pipe to file
var FetchStream = require('../lib/fetch').FetchStream,
fs = require('fs'),
inp, out;
inp = new FetchStream('http://google.com');
out = fs.createWriteStream('google.html');
inp.on('end', function(){
console.log('downloaded!');
});
inp.pipe(out);