AI_botter/node_modules/fetch/example/pipe.js
2024-04-30 17:46:10 -08: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);