Quick Start
Install
npm install @rush-fs/core
# or
pnpm add @rush-fs/coreUse
Import the APIs you need from @rush-fs/core — same names as node:fs:
import { readdir, stat, readFile, writeFile, mkdir, rm } from '@rush-fs/core'
// Read directory
const files = await readdir('./src')
// Recursive with file types
const entries = await readdir('./src', {
recursive: true,
withFileTypes: true,
})
// Read / write files
const content = await readFile('./package.json', { encoding: 'utf8' })
await writeFile('./output.txt', 'hello world')
// File stats
const s = await stat('./package.json')
console.log(s.size, s.isFile())
// Create directory
await mkdir('./new-dir', { recursive: true })
// Remove
await rm('./temp', { recursive: true, force: true })Async and sync
- Async — All APIs are Promise-based; use
awaitor.then(). - Sync — Supported APIs expose a sync variant with the
Syncsuffix (e.g.readdirSync,statSync). See API Overview for the full list.
Compatibility
Rush-FS targets Node.js 18+. Prebuilt binaries are provided for Windows (x64), macOS (x64, arm64), and Linux (x64).
Last updated on