← All notes

The fs/promises API provides asynchronous file system methods that return promises

Answer: To use promise-based file APIs, import node:fs/promises. The fs/promises API provides asynchronous file system methods that return promises. Close it with filehandle.close(); if you do not, the handle stays open.

Import paths

The docs show import * as fs from 'node:fs/promises' for ESM and require('node:fs/promises') for CommonJS. The callback and sync APIs stay on node:fs.

FileHandle

A FileHandle is an EventEmitter wrapper around a descriptor. The 'close' event fires when the handle has been closed.

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: nodejs/node (GitHub), Node.js File system promises API, MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE); Node.js docs, Node.js File system (website), MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: nodejs/node (GitHub), Node.js File system promises API, MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE); Node.js docs, Node.js File system (website), MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE).

Cite this

Permanent ID: iil:note:62pm7t80

iinventedlight. 2026. "The fs/promises API provides asynchronous file system methods that return promises." iinventedlight Library, iil:note:62pm7t80, version of 2026-11-18. https://iinventedlight.com/library/notes/node-fs-promises/. License: CC-BY-4.0.

@misc{iil_note_62pm7t80,
  author = {{iinventedlight}},
  title = {{The fs/promises API provides asynchronous file system methods that return promises}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-18},
  url = {https://iinventedlight.com/library/notes/node-fs-promises/},
  note = {Permanent ID iil:note:62pm7t80. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/node-fs-promises.md.