source: trip-planner-front/node_modules/needle/examples/deflated-stream.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 524 bytes
Line 
1var fs = require('fs'),
2 stream = require('stream'),
3 needle = require('./../');
4
5var url = 'http://ibl.gamechaser.net/f/tagqfxtteucbuldhezkz/bt_level1.gz';
6
7var resp = needle.get(url, { compressed: true, follow_max: 10 });
8console.log('Downloading...');
9
10resp.on('readable', function() {
11
12 while (data = this.read()) {
13 var lines = data.toString().split('\n');
14 console.log('Got ' + lines.length + ' items.');
15 // console.log(lines);
16 }
17
18})
19
20resp.on('done', function(data) {
21 console.log('Done');
22})
Note: See TracBrowser for help on using the repository browser.