Last active
August 2, 2016 06:29
-
-
Save KJlmfe/8346174 to your computer and use it in GitHub Desktop.
Node异步执行
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'); | |
//异步读取Hello.txt | |
fs.readFile('Hello.txt','utf-8', | |
//回调函数里输出Hello.txt里的内容 | |
function(err, data){ | |
console.log(data); | |
} | |
); | |
console.log('End'); | |
/* | |
运行结果: | |
End | |
Hello World | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment