UNPKG

compound-ex4

Version:

Compound-ex4 - MVC framework for NodeJS (ExpressJs 4 version), fork compoundjs(https://github.com/1602/compound)

34 lines (27 loc) 711 B
#!/usr/bin/env node // read a tap stream from stdin. var TapConsumer = require("../lib/tap-consumer") , TapProducer = require("../lib/tap-producer") var tc = new TapConsumer , tp = new TapProducer //process.stdin.pipe(tc) process.stdin.on("data", function (c) { c = c + "" // console.error(JSON.stringify(c).substr(0, 100)) tc.write(c) }) process.stdin.on("end", function () { tc.end() }) process.stdin.resume() //tc.pipe(tp) tc.on("data", function (c) { tp.write(c) }) tc.on("end", function () { tp.end() }) tp.on("data", function (c) { console.error(["output write", c]) process.stdout.write(c) }) tp.on("end", function (er, total, ok) { if (er) throw er process.exit(total - ok) })