Created
March 25, 2016 02:34
-
-
Save seveniu/f8b672871cd37d89dc72 to your computer and use it in GitHub Desktop.
nodejs read file
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
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