UNPKG

395 BJavaScriptView Raw
1var FetchStream = require("../lib/fetch").FetchStream;
2
3var fetch = new FetchStream("http://google.com",{
4 headers:{}
5});
6
7fetch.on("data", function(chunk){
8 console.log(chunk);
9});
10
11fetch.on("meta", function(meta){
12 console.log(meta);
13});
14
15fetch.on("end", function(){
16 console.log("END");
17});
18
19fetch.on("error", function(e){
20 console.log("ERROR: " + (e && e.message || e));
21});
22