Last active
August 29, 2015 14:23
-
-
Save tomsmeding/b87976538093a882c79d to your computer and use it in GitHub Desktop.
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 | |
"use strict"; | |
var fs=require("fs"); | |
var body; | |
if(process.argv[2]=="-"){ | |
body=""; | |
var res; | |
while(true){ | |
res=fs.readSync(0,1024); | |
if(res[1]==0)break; | |
body+=res[0]; | |
} | |
} else { | |
body=String(fs.readFileSync(process.argv[2])); | |
} | |
console.log(JSON.stringify(body)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment