deflated-stream.js 524 B

12345678910111213141516171819202122
  1. var fs = require('fs'),
  2. stream = require('stream'),
  3. needle = require('./../');
  4. var url = 'http://ibl.gamechaser.net/f/tagqfxtteucbuldhezkz/bt_level1.gz';
  5. var resp = needle.get(url, { compressed: true, follow_max: 10 });
  6. console.log('Downloading...');
  7. resp.on('readable', function() {
  8. while (data = this.read()) {
  9. var lines = data.toString().split('\n');
  10. console.log('Got ' + lines.length + ' items.');
  11. // console.log(lines);
  12. }
  13. })
  14. resp.on('done', function(data) {
  15. console.log('Done');
  16. })