# parent-dirs

> Get an array of parent directories including itself

Latest version **3.0.0** (published 2023-11-07) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install parent-dirs
pnpm add parent-dirs
yarn add parent-dirs
bun add parent-dirs
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2023-11-07 |
| First published | 2016-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 2.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | parent, directories, parents, directories, folders, path, paths, array, list |

## Links

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

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2023-11-07
- 2.0.0 — 2021-05-03
- 1.0.0 — 2017-01-13
- 0.1.0 — 2016-05-19

## README

# parent-dirs

> Get an array of parent directories including itself

## Install

```
$ npm install parent-dirs
```

## Usage

```js
import parentDirectories from 'parent-dirs';

parentDirectories();
/*
[
	'/Users/sindresorhus/dev/parent-dirs',
	'/Users/sindresorhus/dev',
	'/Users/sindresorhus',
	'/Users',
	'/'
]
*/
```

## API

### parentDirectories(cwd)

#### cwd

Type: `string`\
Default: `process.cwd()`

Directory starting point to return paths from.

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