fs-extra

Drop-in replacement for Node's fs module adding copy, remove, mkdirs, and JSON helpers with native promise support.

Library
npm
v11.4.0
9,598stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
59/100Fair
Development Activity52
Maintenance20
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
86/100Excellent
Architecture85
Code Quality85
Innovation88
Learning Curve85

fs-extra is one of the most depended-upon packages in the npm ecosystem, adding the file-system methods Node’s built-in fs module leaves out — recursive copy, recursive remove, mkdir -p semantics, empty-directory helpers, symlink/hardlink creation, and direct JSON read/write. Every fs method is re-exported and promisified via universalify, so callers can mix callbacks, promises, and async/await without a separate wrapper library.

Because it clones and extends the native fs object rather than replacing it, teams can swap require('fs') for require('fs-extra') with zero API changes elsewhere in a codebase, then opt into the extra methods as needed. Backed by graceful-fs to avoid EMFILE errors under heavy concurrent file access, it has been a stable dependency of build tools, CLIs, and test harnesses for over a decade.

What You Get

  • Recursive copy/copySync with filters, overwrite control, and timestamp preservation
  • Recursive remove/removeSync (rm -rf equivalent) and emptyDir/emptyDirSync
  • ensureDir/mkdirs (mkdir -p semantics) plus ensureFile, ensureLink, ensureSymlink
  • Direct JSON helpers: readJson, writeJson, outputJson and their sync variants
  • move/moveSync for cross-device-safe renames, and outputFile for write-with-mkdir
  • Every native fs method re-exported and promisified via universalify, plus an ESM build at fs-extra/esm

Common Use Cases

  • Build tools and CLIs that need to copy or clean template/output directories recursively
  • Test suites that scaffold and tear down temporary fixture directories between runs
  • Config and cache tooling that reads/writes JSON files without manual JSON.parse/stringify + mkdir boilerplate
  • Deployment and packaging scripts that move build artifacts between directories across devices

Under The Hood

Architecture fs-extra organizes each capability as its own directory under lib/ (copy, remove, mkdirs, move, json, ensure, empty, output-file, path-exists, plus a shared fs and util), each exporting an async/sync pair that lib/index.js merges into a single namespace via object spread; lib/esm.mjs hand-maps the same functions to named exports for the fs-extra/esm entry point. The fs submodule (lib/fs/index.js) filters Node’s fs method list to what’s actually available on the running Node version, clones it onto the export object, then wraps each method with universalify.fromCallback so native fs behavior is preserved while gaining promise support — this is the mechanism that makes fs-extra a genuine drop-in replacement rather than a parallel API. Tech Stack The runtime dependency surface is deliberately tiny: graceful-fs (queues and retries fs calls to avoid EMFILE/EPERM under load), jsonfile (the JSON read/write engine readJson/writeJson delegate to), and universalify (the promise/callback duality helper used throughout). Pure JavaScript, no native bindings, engines.node >=14.14, and CommonJS-first with a hand-written ESM shim rather than a build step. Code Quality Nearly every lib/<feature> directory has a co-located __tests__ folder (visible under copy, remove, mkdirs, move, json, ensure, empty, fs, util, output-file, path-exists), run through mocha/nyc via npm run unit, plus a dedicated test.mjs for the ESM build and standard as the enforced lint/style config — there is no ambiguity about formatting since standard is non-configurable. Error handling favors explicit try/finally cleanup, visible in lib/util/utimes.js where a file descriptor is always closed even if futimes throws, with the original error preserved and rethrown rather than swallowed. API Design The public surface reads as an extension of fs rather than a competing library: sync methods keep the *Sync suffix Node uses, async methods return promises by default and accept an optional trailing callback for backward compatibility, and naming choices like remove/copy/mkdirs were deliberately chosen (per the README’s naming-rationale section) over inconsistent POSIX-style shorthand. Getting started requires no configuration beyond require('fs-extra') in place of require('fs'), which is close to zero boilerplate for the common case.

Used by 83 apps in this directory

TypeScript
88%
Other

AFFiNE

Productivity · Project Management · Note Taking

71,668

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
68
Dependency
Built with
TypeScript88%
Updated today
TypeScript
84%
MIT

Amical

Note Taking · AI Assistants

1,495

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
79
Repo Health
82
Technical
67
Dependency
Built with
TypeScript84%
Updated 3 weeks ago
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,010

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
61
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 1 months ago
TypeScript
66%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,707

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
94
Repo Health
79
Technical
68
Dependency
Built with
TypeScript66%
Java22%
Updated today
TypeScript
49%
MPL 2.0

Artillery

Devops · Developer Tools

9,054

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
89
Repo Health
73
Technical
68
Dependency
Built with
TypeScript49%
JavaScript48%
Updated 5 days ago
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
96%
Other

CapRover

Developer Tools · Devops · Hosting Control Panel

15,132

Deploy any app, database, or website to your own server in minutes—no Docker or Linux expertise required.

View details
87
Repo Health
82
Technical
69
Dependency
Built with
TypeScript96%
Updated 3 days ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
TypeScript
72%
MIT

Claude Context

AI Code Assistants

12,417

An MCP server and VS Code extension by Zilliz that turns your entire codebase into semantically searchable context for Claude Code, Cursor, and Gemini CLI, using vector embeddings and Merkle-tree change detection.

View details
55
Repo Health
71
Technical
72
Dependency
Built with
TypeScript72%
Python13%
JavaScript11%
Updated 1 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search