Skip to content

Instantly share code, notes, and snippets.

@seveniu
Created March 25, 2016 02:34
Show Gist options
  • Save seveniu/f8b672871cd37d89dc72 to your computer and use it in GitHub Desktop.
Save seveniu/f8b672871cd37d89dc72 to your computer and use it in GitHub Desktop.
nodejs read file
var fs = require('fs');
var filePath = process.argv[2];
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
if (!err){
console.log('received data: ' + data);
}else{
console.log(err);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment