Last active
May 25, 2025 20:08
-
-
Save kristopherjohnson/5065599 to your computer and use it in GitHub Desktop.
Revisions
-
kristopherjohnson revised this gist
Mar 2, 2013 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -16,7 +16,8 @@ stdin.on('data', function (chunk) { stdin.on('end', function () { var inputJSON = inputChunks.join(), parsedData = JSON.parse(inputJSON), outputJSON = JSON.stringify(parsedData, null, ' '); stdout.write(outputJSON); stdout.write('\n'); }); -
kristopherjohnson revised this gist
Mar 2, 2013 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,18 +3,20 @@ // Reads JSON from stdin and writes equivalent // nicely-formatted JSON to stdout. var stdin = process.stdin, stdout = process.stdout, inputChunks = []; stdin.resume(); stdin.setEncoding('utf8'); stdin.on('data', function (chunk) { inputChunks.push(chunk); }); stdin.on('end', function () { var inputJSON = inputChunks.join(), outputJSON = JSON.parse(inputJSON); stdout.write(JSON.stringify(outputJSON, null, ' ')); stdout.write('\n'); }); -
kristopherjohnson revised this gist
Mar 1, 2013 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -3,13 +3,11 @@ // Reads JSON from stdin and writes equivalent // nicely-formatted JSON to stdout. var inputChunks = []; process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (chunk) { inputChunks.push(chunk); }); -
kristopherjohnson revised this gist
Mar 1, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -17,5 +17,6 @@ process.stdin.on('data', function (chunk) { process.stdin.on('end', function () { var inputJSON = inputChunks.join(), outputJSON = JSON.parse(inputJSON); process.stdout.write(JSON.stringify(outputJSON, null, ' ')); process.stdout.write('\n'); }); -
kristopherjohnson created this gist
Mar 1, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/usr/bin/env node // Reads JSON from stdin and writes equivalent // nicely-formatted JSON to stdout. var fs = require('fs'); process.stdin.resume(); process.stdin.setEncoding('utf8'); var inputChunks = []; process.stdin.on('data', function (chunk) { inputChunks.push(chunk); }); process.stdin.on('end', function () { var inputJSON = inputChunks.join(), outputJSON = JSON.parse(inputJSON); console.log(JSON.stringify(outputJSON, null, ' ')); });