Skip to content

Instantly share code, notes, and snippets.

View gerrich's full-sized avatar

Georgy Ivanov gerrich

View GitHub Profile
@gerrich
gerrich / splitline.js
Last active December 15, 2015 10:18 — forked from touv/splitline.js
#!/usr/bin/env node
process.stdin.resume();
process.stdin.setEncoding('utf8');
function line_reader(stream, call_back) {
var remainder = '';
stream.on('data', function (chunk) {
var lines = chunk.toString().split('\n');
lines.unshift(remainder + lines.shift());