# ensure-file

> Ensures that the file path exists.

Latest version **1.0.7** (published 2019-06-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install ensure-file
pnpm add ensure-file
yarn add ensure-file
bun add ensure-file
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2019-06-27 |
| First published | 2016-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.10 |
| Dependencies | 3 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kiko Beats |
| Maintainers | kikobeats |
| Keywords | create, directory, ensure, exists, file, file system, fs, mkdirp, recursive, touch |

## Links

- npm: https://www.npmjs.com/package/ensure-file
- Repository: https://github.com/kikobeats/ensure-file
- Homepage: https://nicedoc.io/Kikobeats/ensure-file
- Issues: https://github.com/Kikobeats/ensure-file/issues
- npm.io page: https://npm.io/package/ensure-file

## Dependencies (3)

- [mkdirp](https://npm.io/package/mkdirp.md) ~0.5.1
- [exists-file](https://npm.io/package/exists-file.md) ~3.0.0
- [graceful-fs](https://npm.io/package/graceful-fs.md) ~4.2.0

## 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.0.7 (latest) — 2019-06-27
- 1.0.6 — 2019-06-19
- 1.0.5 — 2019-05-20
- 1.0.4 — 2018-11-05
- 1.0.3 — 2016-06-28
- 1.0.2 — 2016-06-28
- 1.0.1 — 2016-06-15
- 1.0.0 — 2016-06-15

## README

# ensure-file

![Last version](https://img.shields.io/github/tag/Kikobeats/ensure-file.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/Kikobeats/ensure-file/master.svg?style=flat-square)](https://travis-ci.org/Kikobeats/ensure-file)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/ensure-file.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/ensure-file)
[![Dependency status](https://img.shields.io/david/Kikobeats/ensure-file.svg?style=flat-square)](https://david-dm.org/Kikobeats/ensure-file)
[![Dev Dependencies Status](https://img.shields.io/david/dev/Kikobeats/ensure-file.svg?style=flat-square)](https://david-dm.org/Kikobeats/ensure-file#info=devDependencies)
[![NPM Status](https://img.shields.io/npm/dm/ensure-file.svg?style=flat-square)](https://www.npmjs.org/package/ensure-file)
[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg?style=flat-square)](https://paypal.me/Kikobeats)

> Ensures that the file path exists. Like [fs-extra#ensureFile](https://github.com/jprichardson/node-fs-extra#ensurefilefile-callback) but out of the box.

## Install

```bash
$ npm install ensure-file --save
```

## Usage

```js
'use strict'

var ensureFile = require('ensure-file')
var file = '/tmp/this/path/does/not/exist/file.txt'

ensureFile(file, function (err) {
  console.log(err) // => null
  // file has now been created, including the directory it is to be placed in
})
```

## API

### ensureFile(file, cb)
### ensureFile.sync(file)

#### file

*Required*
Type: `string`

## License

MIT © [Kiko Beats](http://kikobeats.com)

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