AI_botter/node_modules/fetch/example/pipe.js

17 lines
292 B
JavaScript
Raw Normal View History

2024-05-01 02:46:10 +01:00
'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);