Skip to content

Instantly share code, notes, and snippets.

@JialunC
Created March 7, 2018 03:41
Show Gist options
  • Save JialunC/9d3a328b6d5100fe9901d7c3b315d443 to your computer and use it in GitHub Desktop.
Save JialunC/9d3a328b6d5100fe9901d7c3b315d443 to your computer and use it in GitHub Desktop.
Asynchronous tasks and callbacks from Lynda Learning Node.js
// 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