Joined September 2013
·

ramsperger

USA
·
·

Save this on your PATH. Read the first arg as the file or read stdin. When piping to it, /dev/stdin will look like a file and get and EOF when it's done... assuming your JSON doesn't overrun the memory, it should work.

#!/usr/bin/env node var args = process.argv.splice( /node$/.test(process.argv[0]) ? 2 : 1 ); console.log( JSON.stringify( JSON.parse( require('fs') .readFileSync( args.length > 0 ? args[0] : "/dev/stdin" ) ), null, 4) );
Achievements
10 Karma
0 Total ProTip Views
Interests & Skills