# @kwsites/file-exists

> Synchronous validation of a path existing either as a file or as a directory.

Latest version **1.1.1** (published 2020-06-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kwsites/file-exists
pnpm add @kwsites/file-exists
yarn add @kwsites/file-exists
bun add @kwsites/file-exists
```

## 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 | 2020-06-10 |
| First published | 2018-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 14 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Steve King |
| Maintainers | steveukx |

## Links

- npm: https://www.npmjs.com/package/@kwsites/file-exists
- Repository: https://github.com/kwsites/file-exists
- Homepage: https://github.com/kwsites/file-exists#readme
- Issues: https://github.com/kwsites/file-exists/issues
- npm.io page: https://npm.io/package/@kwsites/file-exists

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^4.1.1

## Recent versions

- 1.1.1 (latest) — 2020-06-10
- 1.1.0 — 2020-06-10
- 1.0.0 — 2018-10-25

## README

# @kwsites/file-exists

Synchronous validation of a path existing either as a file or as a directory.

```
const { exists, FILE, FOLDER, READABLE } = require('@kwsites/file-exists');

// check for a folder existing
assert(exists(__dirname, FOLDER));
assert(!exists(__filename, FOLDER));

// check for a file existing
assert(!exists(__filename, FILE));
assert(exists(__filename, FILE));

// when no type is specified, both folders and files are allowed
assert(exists(__dirname));
assert(exists(__filename));

// alternatively specify both files and folders
assert(exists(__dirname, FILE + FOLDER));

// or just that the path is readable (can be either a file or folder)
assert(exists(__filename, READABLE));
```

## Troubleshooting

This library uses [debug](https://www.npmjs.com/package/debug) to handle logging,
to enable logging, use either the environment variable:

```
"DEBUG=@kwsites/file-exists" node ./your-app.js 
``` 

Or explicitly enable logging using the `debug` library itself:

```javascript
require('debug').enable('@kwsites/file-exists');
```

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