# path-dirname

> Node.js path.dirname() ponyfill

Latest version **1.0.2** (published 2016-10-18) · MIT license · 0 weekly downloads

## Install

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

## 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.2 |
| Published | 2016-10-18 |
| First published | 2016-10-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 13 |
| Author | Elan Shanker |
| Maintainers | es128 |
| Keywords | dirname, dir, path, paths, file, built-in, util, utils, core, stdlib, ponyfill, polyfill, shim |

## Links

- npm: https://www.npmjs.com/package/path-dirname
- Repository: https://github.com/es128/path-dirname
- Homepage: https://github.com/es128/path-dirname#readme
- Issues: https://github.com/es128/path-dirname/issues
- npm.io page: https://npm.io/package/path-dirname

## 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

- 1.0.2 (latest) — 2016-10-18

## README

# path-dirname [![Build Status](https://travis-ci.org/es128/path-dirname.svg?branch=master)](https://travis-ci.org/es128/path-dirname)

> Node.js [`path.dirname()`](https://nodejs.org/api/path.html#path_path_dirname_path) [ponyfill](https://ponyfill.com)

This was needed in order to expose `path.posix.dirname()` on Node.js v0.10

## Install

```
$ npm install --save path-dirname
```


## Usage

```js
const pathDirname = require('path-dirname');

pathDirname('/home/foo');
//=> '/home'
pathDirname('C:\\Users\\foo');
//=> 'C:\\Users'
pathDirname('foo');
//=> '.'
pathDirname('foo/bar');
//=> 'foo'

//Using posix version for consistent output when dealing with glob escape chars
pathDirname.win32('C:\\Users\\foo/\\*bar');
//=> 'C:\\Users\\foo/'
pathDirname.posix('C:\\Users\\foo/\\*bar');
//=> 'C:\\Users\\foo'
```


## API

See the [`path.dirname()` docs](https://nodejs.org/api/path.html#path_path_dirname_path).

### pathDirname(path)

### pathDirname.posix(path)

POSIX specific version.

### pathDirname.win32(path)

Windows specific version.


## License

MIT

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