Skip to content

Instantly share code, notes, and snippets.

@polotek
Forked from igrigorik/read_activity.rb
Created October 24, 2012 20:48
Show Gist options
  • Save polotek/3948783 to your computer and use it in GitHub Desktop.
Save polotek/3948783 to your computer and use it in GitHub Desktop.
var request = require('request')
, gunzip = require('zlib').createGunzip()
, json = new (require('jstream'))();
request('http://data.githubarchive.org/2012-03-11-12.json.gz')
.pipe(gunzip)
.pipe(json)
.on('data', function(obj) {
console.log(obj);
});
require 'open-uri'
require 'zlib'
require 'yajl'
gz = open('http://data.githubarchive.org/2012-03-11-12.json.gz')
js = Zlib::GzipReader.new(gz).read
Yajl::Parser.parse(js) do |event|
print event
end
@mikeal
Copy link

mikeal commented Oct 24, 2012

does jstream have the same semantics as JSONStream?

@polotek
Copy link
Author

polotek commented Oct 24, 2012

Not sure. I haven't used jsonstream or jstream before. I just looked around for the first thing that looked promising and depended on @dscape's clarinet. But it seems to be a valid stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment