Created
April 20, 2016 02:29
-
-
Save ahgood/1d112596255fad71409e85bc21acdcdf to your computer and use it in GitHub Desktop.
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
//m.js | |
var fs = require('fs'); | |
module.exports = function(filename, callback) { | |
fs.readFile(filename, 'utf8', function(err, data){ | |
if (err) throw err; | |
callback(data); | |
}); | |
} | |
//u.js | |
var getContent = require('./m'); | |
getContent('h.txt', function(data) { | |
console.log(data); | |
}); | |
//h.txt | |
Hello Nodejs. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment