node:fs

The built-in Node.js module for working with files and folders, in promise, callback and synchronous forms.

In more detail

The promise API in node:fs/promises is the modern choice: every function returns a promise and the work runs on libuv's thread pool. The Sync functions block the event loop and suit scripts and start-up code.

Example

Next.js Server Components in the Node.js runtime can read files with it; the Edge runtime cannot.

Related terms

Taught in

References