# Overview of Blocking vs Non-Blocking | Node.js
source: https://ift.tt/urVS7pP tags: #literature #inbox #programming #software-engineering #airtable #javascript uid: 202301260139 —
In Node.js, JavaScript that exhibits poor performance due to being CPU intensive rather than waiting on a non-JavaScript operation, such as I/O, isn’t typically referred to as blocking. Synchronous methods in the Node.js standard library that use libuv are the most commonly used blocking operations. Native modules may also have blocking methods.
Using the File System module as an example, this is a synchronous file read:
const fs = require(“fs”); const data = fs.readFileSync(“/file.md”); // blocks here until file is read And here is an equivalent asynchronous example:
const fs = require(“fs”); fs.readFile(“/file.md”, (err, data) => { if (err) throw err; });