Skip to content

Instantly share code, notes, and snippets.

@rasolofonirina
Last active March 25, 2022 12:45
Show Gist options
  • Save rasolofonirina/ca5474f7c90fbae604dc30290ce2f710 to your computer and use it in GitHub Desktop.
Save rasolofonirina/ca5474f7c90fbae604dc30290ce2f710 to your computer and use it in GitHub Desktop.
blocking vs non-blocking
// Blocking
const fs = require('fs')
const data = fs.readFileSync('/file.txt')
console.log(data)
// Non-blocking
const fs = require('fs')
fs.readFile('/file.txt', (err, data) => {
if (err) throw err
console.log(data)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment