Skip to content
masterclass Buddy

Node.js · Module

node:fs

Node.js can read files with callback, synchronous, or promise-based APIs. These APIs load the whole file into memory, so streams are better for large files.

Last updated

Syntax

fs.readFile(path, encoding, callback)
fs.readFileSync(path, encoding)
fsPromises.readFile(path, options)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • node:fs
  • node:fs/promises
  • fs.readFile
  • fs.readFileSync
  • fsPromises.readFile
  • fs.createReadStream

Source: Reading files with Node.js | Node.js Learn. Checked 2026-11-03.