fs-extra
Drop-in replacement for Node's `fs` with extra methods like recursive copy, remove, and ensure.
fs-extra
Node.jsDrop-in replacement for Node's `fs` with extra methods like recursive copy, remove, and ensure.
Fit
Bundle (gzip)
8.8 kB
29.9 kB raw
Install size includes transitive dependencies. Bundle size is gzipped browser payload.
Freshness
The Problem
Common filesystem tasks — copying a directory tree, removing a folder recursively, or creating a nested path if it doesn't exist — require multiple steps and careful error handling with the built-in fs module.
What It Does
fs-extra adds promise-friendly helpers such as copy, remove, ensureDir, outputFile, and emptyDir on top of the native fs API, so it works as a direct replacement while removing boilerplate.
Installation
npm install fs-extraUsage Example
import fs from "fs-extra";
await fs.ensureDir("dist/assets");
await fs.copy("public", "dist/assets");
await fs.outputFile("dist/build.txt", `built at ${new Date().toISOString()}`);
const exists = await fs.pathExists("dist/build.txt");
console.log("build file written:", exists);Related packages
Role and attribute based access control (RBAC + ABAC) for Node.js with a fluent, readable API.
bcryptjsNode.jsPure JavaScript bcrypt password hashing — no native dependencies, same API as bcrypt, works anywhere Node.js runs.
bullmqNode.jsPremium message queue and job scheduler for Node.js backed by Redis — reliable background job processing with retries, priorities, and rate limiting.
casbinNode.jsA powerful authorization library that supports RBAC, ABAC, ACL and more via configurable policy models.
dotenvNode.jsLoad environment variables from a `.env` file into `process.env` — the standard way to manage configuration in Node.js apps.