Created
February 14, 2011 10:14
-
-
Save temsa/825687 to your computer and use it in GitHub Desktop.
Cat a file with node in one line
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 characters
#!/usr/local/bin/node | |
require(‘fs’).readFile(process.argv[2], function(err,buf){ process.stdout.write(buf); }); |
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 characters
#!/usr/local/bin/node | |
var args = process.argv.splice(2,process.argv.length-1); | |
args.forEach(function (file){ | |
if(args.length >1) | |
console.log(‘========> %s <=========’,file); | |
require(‘fs’).readFile(file, function(err,buf){ | |
process.stdout.write(buf); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment