Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Playing with Stream and Nodejs
var request = require("request");
var zlib = require("zlib");
var csv = require("csv-streamify");
var Handlebars = require("handlebars");
var es = require("event-stream");
var tmpl = Handlebars.compile("<li><a href="{{URL}}">{{Name}}</a> ({{City}})</li>");
// HTTP GET Request
// Un-Gzip
// Parse CSV as Object
.pipe(csv({objectMode: true, columns: true}))
// Convert Object w/ Handlebars
// Join Strings
// Concat Strings
// Wrap Strings
.pipe(es.mapSync(function(data) { return "<ul>" + data + "\n</ul>"; }));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment