yusenthebot

fs-extra

fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.. Use when: reading and writing files with extras; directory operations; file pattern matching. NOT for: database replacement; network storage without proper SDKs.

yusenthebot 0 Updated 3mo ago
GitHub

Install

npx skillscat add yusenthebot/skills-pack/fs-extra

Install via the SkillsCat registry.

SKILL.md

fs-extra

Overview

fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.. Node.js: fs-extra ================= fs-extra adds file system methods that aren't included in the native fs module and adds promise support to the fs methods.

Installation

npm install fs-extra

Core API / Usage

const fs = require('fs') // this is no longer necessary
const fs = require('fs-extra')

Common Patterns

Pattern 1

const fse = require('fs-extra')

Pattern 2

const fs = require('fs')
const fse = require('fs-extra')

Pattern 3

import { readFileSync } from 'fs'
import { readFile } from 'fs/promises'
import { outputFile, outputFileSync } from 'fs-extra/esm'

Configuration

See the official documentation for configuration options and advanced settings.

Tips & Gotchas

  • Supports both ESM (import) and CommonJS (require()).
  • Current version: 11.3.4. Check the changelog when upgrading across major versions.