Created
March 7, 2018 03:41
-
-
Save JialunC/9d3a328b6d5100fe9901d7c3b315d443 to your computer and use it in GitHub Desktop.
Asynchronous tasks and callbacks from Lynda Learning Node.js
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
// this is a sync-demo | |
fs = require('fs') | |
data = fs.readdirSync('c:/') | |
console.log(data) | |
console.log('this is the data') | |
// this is a async-demo | |
fs = require('fs') | |
function phone(err,data) { | |
console.log('data:', data) | |
} | |
fs.readdir('c:/',phone) | |
console.log("this is the data") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment