Skip to content

Instantly share code, notes, and snippets.

@prasmussen
Created June 16, 2012 23:04
Show Gist options
  • Save prasmussen/2942753 to your computer and use it in GitHub Desktop.
Save prasmussen/2942753 to your computer and use it in GitHub Desktop.
#!/usr/bin/node
var args = process.argv;
if (args.length < 3) {
console.log("Usage: " + args[1] + " <text file>");
process.exit(1);
}
fs = require('fs');
fs.readFile(args[2], function(err, data) {
if (err) {
console.log(err);
process.exit(1);
}
json = JSON.stringify(data.toString());
console.log(json);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment