Skip to content

Instantly share code, notes, and snippets.

@KJlmfe
Last active August 2, 2016 06:29
Show Gist options
  • Save KJlmfe/8346174 to your computer and use it in GitHub Desktop.
Save KJlmfe/8346174 to your computer and use it in GitHub Desktop.
Node异步执行
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