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.
SubscribeRelated
node:fsnode:fs/promisesfs.readFilefs.readFileSyncfsPromises.readFilefs.createReadStream