Skip to content

Instantly share code, notes, and snippets.

function processFile(file) {
fs.createReadStream(file) // open the gzipped csv file and start sending chunks of it downstream
.pipe(zlib.createGunzip()) // once you get a chunk, decompress it and pass it downstream
.pipe(csv()) // convert the decompressed chunk into individual rows and values
.on('data', processRow(row)) // if a row has a parallax measurement, calculate its position and write it to a new file
}
var http = require('http')
class HttpStore {
constructor(storeUrl) {
// begin downloading the url we requested, stream it to our handleData function
http.get(storeUrl, (res) => {
res.on('data', this.handleData.bind(this))
res.on('end', this.handleEnd.bind(this))