# pstat

> Check if file or directory exists

Latest version **1.0.2** (published 2016-06-22) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install pstat
pnpm add pstat
yarn add pstat
bun add pstat
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2016-06-22 |
| First published | 2016-06-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Josemi Juanes |
| Maintainers | jmjuanes |
| Keywords | stat, file, directory, exists |

## Links

- npm: https://www.npmjs.com/package/pstat
- Repository: https://github.com/jmjuanes/pstat
- Issues: https://github.com/jmjuanes/pstat/issues
- npm.io page: https://npm.io/package/pstat

## 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.2 (latest) — 2016-06-22
- 1.0.1 — 2016-06-18
- 1.0.0 — 2016-06-17

## README

# pStat

[![npm](https://img.shields.io/npm/v/pstat.svg?style=flat-square)](https://www.npmjs.com/package/pstat)
[![npm](https://img.shields.io/npm/dt/pstat.svg?style=flat-square)](https://www.npmjs.com/package/pstat)

Check if file or directory exists in Node.JS.


## Install

Use NPM to install the package:

```
npm install pstat
```

## Usage

Include the package using:

```javascript
var pStat = require('pstat');
```

### pStat.isFile(path, callback)

Asynchronously check if path exists and is a file. The callback is passed with `true` if path exists and is a file or `false` if not. Example:

```javascript
pStat.isFile('./folder/file.txt', function(is_file){ /* do something */ });
```

### pStat.isFileSync(path)

Synchronous version of `pStat.isFile`. Returns `true` if path exists and is a file, `false` if not.

### pStat.isDir(path, callback)

Asynchronously check if path exists and is a directory. The callback is passed with `true` if path exists and is a directory or `false` if not. Example:

```javascript
pStat.isDir('./your/folder', function(is_dir){ /* do something */ });
```

### pStat.isDirSync(path)

Synchronous version of `pStat.isDir`. Returns `true` if path exists and is a directory, `false` if not.

## License

[MIT](./LICENSE) Jose M. Juanes.

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