# with-tmp

> ### Easily create a temporary directory without having to worry about cleanup.

Latest version **1.1.1** (published 2019-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install with-tmp
pnpm add with-tmp
yarn add with-tmp
bun add with-tmp
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-05-27 |
| First published | 2019-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 114 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Charles Kenney |
| Maintainers | charleskenney |
| Keywords | files, fs, directories, tmp, tmpdir |

## Links

- npm: https://www.npmjs.com/package/with-tmp
- Repository: https://github.com/charliekenney23/fs-cmp
- Homepage: https://github.com/charliekenney23/fs-cmp#readme
- Issues: https://github.com/charliekenney23/fs-cmp/issues
- npm.io page: https://npm.io/package/with-tmp

## Dependencies (2)

- [rimraf](https://npm.io/package/rimraf.md) ^2.6.3
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.1.1 (latest) — 2019-05-27
- 1.1.0 — 2019-05-24

## README

# with-tmp [![Build Status](https://travis-ci.org/charliekenney23/with-tmp.svg?branch=master)](https://travis-ci.org/charliekenney23/with-tmp)

### Easily create a temporary directory without having to worry about cleanup.

```typescript
import withTmpdir from "with-tmp";

await withTmpdir("my-tmp-dir", dir => {
  const path = path.join(dir, "my-file");
  fs.writeFileSync(path, "content");
}); // tmpdir is cleaned up
```

### Do tasks from within the temporary directory without having to worry about restoring your environment.

```typescript
import { withinTmpdir } from "with-tmp";

process.cwd(); // => /home/me/workspace
await withinTmpdir("my-other-tmp-dir", dir => {
  process.cwd(); // => /private/var/folders/83/5913m0b1080000gn/T/my-other-tmp-dir2Ivp7V
});
```

---
_Source: https://npm.io/package/with-tmp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
