Created
April 10, 2012 04:03
-
-
Save maks/2348249 to your computer and use it in GitHub Desktop.
basic json pretty printing for cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var pd = require('pretty-data').pd; | |
var buf = ""; | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
process.stdin.on('data', function (chunk) { | |
//process.stdout.write(chunk); | |
buf += chunk; | |
}); | |
process.stdin.on('end', function () { | |
process.stdout.write(pd.json(buf)+'\n'); | |
process.exit(0); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment