← All recipes
Moderne licensed

Replace fs-extra's re-exported fs methods with node:fs

Recipe IDorg.openrewrite.node.migrate.fs-extra.replace-fs-extra-native-methodsArtifact@openrewrite/recipes-nodejs

fs-extra re-exports every fs method, with the async ones returning a promise when no callback is passed. Promise-form calls move to node:fs/promises; callback-form calls, *Sync methods, streams, watchers and constants move to node:fs. fd-based methods keep their promise form on fs-extra, as node:fs/promises has no fd-number equivalents.

Single recipeProprietary

Usage

This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.node.migrate.fs-extra.replace-fs-extra-native-methods

If the recipe isn’t available locally, install it with:

mod config recipes npm install @openrewrite/recipes-nodejs