API Reference
graceful-fs
Drop-in fs replacement that handles EMFILE and other errors gracefully with retries.
Official Documentation ↗CompatibilityThis documentation covers version
v4.2.11. Check the official docs for the latest API surface.Installation
npm
npm install graceful-fspnpm
pnpm add graceful-fsMethods
No methods match this filter.
graceful-fs is drop-in fs replacement that handles EMFILE and other errors gracefully with retries.
Key Features
Installation
npm install graceful-fs
Usage
Errors
The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/isaacs/node-graceful-fs@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:50:04.854Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.
- The improvements are meant to normalize behavior across different platforms and environments, and to make filesystem access more resilient to errors. (https://cdn.jsdelivr.net/gh/isaacs/node-graceful-fs@latest/README.md)
- Improvements over fs module * Queues up open and readdir calls, and retries them once something closes if there is an EMFILE error from too many file descriptors. (https://cdn.jsdelivr.net/gh/isaacs/node-graceful-fs@latest/README.md)
- On Windows, it retries renaming a file for up to one second if EACCESS or EPERM error occurs, likely because antivirus software has locked the directory. (https://cdn.jsdelivr.net/gh/isaacs/node-graceful-fs@latest/README.md)
FAQ
- Is graceful-fs cross-platform?
- Yes, graceful-fs works on Windows, macOS, and Linux, normalizing paths and permission modes.
- Does graceful-fs handle EMFILE errors?
- Yes, graceful-fs gracefully retries on too many open files, avoiding EMFILE crashes.
- Are operations atomic?
- Atomic variants write to a temp file then rename, preventing partial reads during concurrent writes.
Report a problem with this API docOpens a pre-filled issue on GitHub.