About this project
fs-extra is a comprehensive Node.js library that enhances the native `fs` module by adding commonly needed file system operations and full promise support. It is designed as a drop-in replacement, meaning it includes all standard `fs` methods alongside new utilities.
Key capabilities include recursive file copying (`copy`), recursive deletion (`remove`), ensuring file/directory existence (`ensureFile`, `ensureDir`), and creating directories recursively (`mkdirs`, `mkdirp`). It also provides utilities for writing files with auto-created parent directories (`outputFile`), moving files (`move`), and handling JSON data directly (`readJson`, `writeJson`, `outputJson`). All async methods return promises and support callbacks, while sync variants (e.g., `copySync`) are available for blocking operations.
To handle large-scale file operations safely, fs-extra relies on `graceful-fs` to avoid `EMFILE` errors. The library supports both CommonJS and ES Module imports. The project includes extensive tests, follows standard JavaScript style, and has a rich ecosystem of third-party tools like a CLI interface and TypeScript definitions.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.