> ## 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.

# tmpDir to tmpdir

> Migrate deprecated os.tmpDir() to os.tmpdir() for Node.js DEP0022

This recipe transforms `tmpDir` function calls to `tmpdir` to handle Node.js [DEP0022](https://nodejs.org/docs/latest/api/deprecations.html#dep0022-ostmpdir).

## What It Does

This codemod updates:

* Function calls from `tmpDir()` to `tmpdir()`
* Import/require statements to use the correct function name

## Before/After

<Tabs>
  <Tab title="ESM">
    **Before:**

    ```javascript theme={null}
    import { tmpDir } from 'node:os';
    const foo = tmpDir();
    ```

    **After:**

    ```javascript theme={null}
    import { tmpdir } from 'node:os';
    const foo = tmpdir();
    ```
  </Tab>

  <Tab title="CommonJS">
    **Before:**

    ```javascript theme={null}
    const { tmpDir } = require('node:os');
    const foo = tmpDir();
    ```

    **After:**

    ```javascript theme={null}
    const { tmpdir } = require('node:os');
    const foo = tmpdir();
    ```
  </Tab>
</Tabs>

## Usage

Run this codemod on your project:

```bash theme={null}
npx codemod node/userland/tmpdir-to-tmpdir
```

<Tip>
  This is a simple naming change where `tmpDir()` (with capital 'D') was deprecated in favor of the lowercase `tmpdir()` to maintain consistency with Node.js naming conventions.
</Tip>

## Related Deprecations

* [DEP0022: os.tmpDir()](https://nodejs.org/docs/latest/api/deprecations.html#dep0022-ostmpdir)
