talira

fs-extra

Node.js fs with recursive mkdir, copy, remove and promises

open sourceMITfree

fs-extra is a drop-in replacement for Node.js's fs module that adds the file-system methods fs leaves out, such as recursive copy, remove, mkdirs, move, emptyDir and reading and writing JSON files, and makes every fs method return a promise when no callback is given. It uses graceful-fs to avoid EMFILE errors when many files are open. Its author wrote it to stop pulling mkdirp, rimraf and ncp into every project.

Problems it solves

  • copy a whole directory recursively in Node.js
  • delete a folder and everything in it from a Node script
  • create nested directories in Node without writing it myself

Features

  • recursive copy, remove, move and mkdirs
  • read and write JSON files
  • promise support for every fs method
  • drop-in replacement for fs

Alternatives

The same job

These do what fs-extra does.

  1. del Delete files and directories by glob in Node.js, with a promise API
  2. rimraf rm -rf for Node.js, cross-platform
  3. globby Glob matching for Node.js with negated patterns, directory expansion and .gitignore support
  4. tmp (Node.js) Temporary file and directory creator for Node.js

Compare fs-extra with the top 3