> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/nodejs/userland-migrations/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration Recipes Overview

> Comprehensive guide to all Node.js userland migration recipes for updating deprecated APIs and adopting modern best practices

Node.js migration recipes help you automatically update deprecated APIs, migrate from external packages to built-in modules, and adopt modern Node.js best practices. Each recipe is a targeted codemod that can be run independently.

## Getting Started

All recipes are run using the `codemod` CLI tool:

```bash theme={null}
npx codemod nodejs/<recipe-name>
```

<Warning>
  Before running any migration recipe, commit your changes to version control. Codemods modify your source code directly.
</Warning>

## Recipe Categories

### Buffer & Encoding

Migrations related to buffer operations and encoding/decoding.

* [**buffer-atob-btoa**](/recipes/buffer-atob-btoa) - Migrate from legacy `buffer.atob()` and `buffer.btoa()` to modern Buffer APIs

### Crypto & Security

Migrations for cryptographic APIs and security-related deprecations.

* [**createCredentials-to-createSecureContext**](/recipes/createCredentials-to-createSecureContext) - Replace `crypto.createCredentials` with `tls.createSecureContext` (DEP0010)
* [**crypto-fips-to-getFips**](/recipes/crypto-fips-to-getFips) - Replace `crypto.fips` property with `crypto.getFips()` and `crypto.setFips()` (DEP0093)
* [**crypto-rsa-pss-update**](/recipes/crypto-rsa-pss-update) - Update RSA-PSS key generation options from `hash`/`mgf1Hash` to `hashAlgorithm`/`mgf1HashAlgorithm` (DEP0154)

### File System

Migrations for file system API updates and deprecations.

* [**dirent-path-to-parent-path**](/recipes/dirent-path-to-parent-path) - Replace `dirent.path` with `dirent.parentPath` (DEP0178)
* [**fs-access-mode-constants**](/recipes/fs-access-mode-constants) - Move access mode constants from `fs.*` to `fs.constants.*` (DEP0176)

### Module System

Migrations related to CommonJS and ES modules.

* [**create-require-from-path**](/recipes/create-require-from-path) - Replace `createRequireFromPath` with `createRequire` (DEP0130)

### TypeScript

Migrations specific to TypeScript codebases.

* [**correct-ts-specifiers**](/recipes/correct-ts-specifiers) - Fix TypeScript import specifiers to use correct file extensions for Node.js compatibility

### External Dependencies

Migrations from third-party packages to Node.js built-in modules.

* [**chalk-to-util-styletext**](/recipes/chalk-to-util-styletext) - Replace the `chalk` package with Node.js built-in `util.styleText()`

## Common Usage Patterns

### Run a Single Recipe

```bash theme={null}
npx codemod nodejs/buffer-atob-btoa
```

### Target Specific Files

```bash theme={null}
npx codemod nodejs/chalk-to-util-styletext --target "src/**/*.js"
```

### Dry Run (Preview Changes)

```bash theme={null}
npx codemod nodejs/crypto-fips-to-getFips --dry
```

<Tip>
  Run `npx codemod --help` to see all available options for controlling how codemods are applied.
</Tip>

## Deprecation References

Many recipes address specific Node.js deprecation warnings (DEP codes). You can find the full list of deprecations in the [official Node.js documentation](https://nodejs.org/api/deprecations.html).

## Contributing

Found a bug or want to add a new recipe? Visit the [Node.js Userland repository](https://github.com/nodejs/userland) to contribute.
