amazon-review-stream
v0.0.1
Published
Node Transform Stream for parsing Amazon Reviews from the Snap dataset into JavaScript objects
Downloads
1
Readme
Amazon Review Stream
Node Transform Stream for parsing the SNAP Amazon Review datasets into JavaScript objects.
Usage
Assuming you've saved a SNAP dataset locally.
var fs = require('fs'),
reviews = require('amazon-review-stream');
var reviewStream = fs.createReadStream('./Arts.txt.gz').pipe(reviews());
reviewStream.on('data', function(item) {
console.log('Product: %s', item.product.title);
console.log('Review: %s', item.review.summary);
});
Of course if you're a very patient person, you could just stream directly from the SNAP site. Keep in mind this below sample will pull down 4.4GB of data if you sit through it...
var request = require('request'),
reviews = require('amazon-review-stream');
var reviewStream = request('http://snap.stanford.edu/data/amazon/Books.txt.gz').pipe(reviews());
reviewStream.on('data', function(item) {
console.log('Review: %s', item.review.summary);
});