# path-type

> Check if a path is a file, directory, or symlink

Latest version **6.0.0** (published 2024-07-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install path-type
pnpm add path-type
yarn add path-type
bun add path-type
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2024-07-26 |
| First published | 2015-09-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 81 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | path, fs, type, is, check, directory, file, filepath, symlink, symbolic, link, stat, stats, filesystem |

## Links

- npm: https://www.npmjs.com/package/path-type
- Repository: https://github.com/sindresorhus/path-type
- Homepage: https://github.com/sindresorhus/path-type#readme
- Issues: https://github.com/sindresorhus/path-type/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/path-type

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 6.0.0 (latest) — 2024-07-26
- 5.0.0 — 2021-01-27
- 4.0.0 — 2019-03-12
- 3.0.0 — 2017-07-08
- 2.0.0 — 2016-09-28
- 1.1.0 — 2015-11-14
- 1.0.0 — 2015-09-04

## README

# path-type

> Check if a path is a file, directory, or symlink

## Install

```sh
npm install path-type
```

## Usage

```js
import {isFile} from 'path-type';

console.log(await isFile('package.json'));
//=> true
```

## API

### isFile(path)

Check whether the passed `path` is a file.

Returns a `Promise<boolean>`.

#### path

Type: `string`

The path to check.

### isDirectory(path)

Check whether the passed `path` is a directory.

Returns a `Promise<boolean>`.

### isSymlink(path)

Check whether the passed `path` is a symlink.

Returns a `Promise<boolean>`.

### isFileSync(path)

Synchronously check whether the passed `path` is a file.

Returns a `boolean`.

### isDirectorySync(path)

Synchronously check whether the passed `path` is a directory.

Returns a `boolean`.

### isSymlinkSync(path)

Synchronously check whether the passed `path` is a symlink.

Returns a `boolean`.

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