# parse-filepath

> Pollyfill for node.js `path.parse`, parses a filepath into an object.

Latest version **1.0.2** (published 2017-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install parse-filepath
pnpm add parse-filepath
yarn add parse-filepath
bun add parse-filepath
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2017-12-19 |
| First published | 2014-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/parse-filepath) |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 31 |
| Author | Jon Schlinkert |
| Maintainers | phated, doowb, jonschlinkert |
| Keywords | absolute, basename, dir, directory, dirname, ext, extension, extname, file, filename, filepath, is-absolute, name, object, parse, parser, parts, path, segment |

## Links

- npm: https://www.npmjs.com/package/parse-filepath
- Repository: https://github.com/jonschlinkert/parse-filepath
- Issues: https://github.com/jonschlinkert/parse-filepath/issues
- npm.io page: https://npm.io/package/parse-filepath

## Dependencies (3)

- [map-cache](https://npm.io/package/map-cache.md) ^0.2.0
- [path-root](https://npm.io/package/path-root.md) ^0.1.1
- [is-absolute](https://npm.io/package/is-absolute.md) ^1.0.0

## 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) — 2017-12-19
- 1.0.1 — 2016-03-29
- 1.0.0 — 2016-03-29
- 0.6.3 — 2015-07-29
- 0.6.2 — 2015-07-21
- 0.6.1 — 2015-07-11
- 0.6.0 — 2015-07-09
- 0.5.0 — 2014-11-13
- 0.4.1 — 2014-11-13
- 0.4.0 — 2014-10-28
- 0.3.1 — 2014-10-19
- 0.3.0 — 2014-06-26
- 0.2.2 — 2014-06-22
- 0.2.1 — 2014-05-09
- 0.2.0 — 2014-05-09
- … 1 more at https://npm.io/package/parse-filepath/versions

## README

# parse-filepath [![NPM version](https://img.shields.io/npm/v/parse-filepath.svg?style=flat)](https://www.npmjs.com/package/parse-filepath) [![NPM downloads](https://img.shields.io/npm/dm/parse-filepath.svg?style=flat)](https://npmjs.org/package/parse-filepath) [![Build Status](https://img.shields.io/travis/jonschlinkert/parse-filepath.svg?style=flat)](https://travis-ci.org/jonschlinkert/parse-filepath)

> Pollyfill for node.js `path.parse`, parses a filepath into an object.

You might also be interested in [global-prefix](https://github.com/jonschlinkert/global-prefix).

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install parse-filepath --save
```

## Usage

```js
var parsePath = require('parse-filepath');
parsePath(filepath);
```

This can be used as a polyfill for the native node.js `path.parse()` method, and it also adds a few properties:

* `path`: the original filepath
* `isAbsolute`: (getter) true if the given path is absolute
* `absolute`: (getter) fully resolved, absolute filepath
* `dirname`: alias for `dir`
* `basename`: alias for `base`
* `extname`: alias for `ext`
* `stem`: alias for `name`

**Example**

```js
var parsePath = require('parse-filepath');
console.log(parsePath('foo/bar/baz/index.js'));
```

Returns:

```js
{ root: '',
  dir: 'foo/bar/baz',
  base: 'index.js',
  ext: '.js',
  name: 'index',

  // aliases
  extname: '.js',
  basename: 'index.js',
  dirname: 'foo/bar/baz',
  stem: 'index',

  // original path
  path: 'foo/bar/baz/index.js',

  // getters
  absolute: [Getter/Setter],
  isAbsolute: [Getter/Setter] }
```

## Related projects

You might also be interested in these projects:

* [global-prefix](https://www.npmjs.com/package/global-prefix): Get the npm global path prefix. | [homepage](https://github.com/jonschlinkert/global-prefix)
* [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute)
* [is-relative](https://www.npmjs.com/package/is-relative): Returns `true` if the path appears to be relative. | [homepage](https://github.com/jonschlinkert/is-relative)
* [relative](https://www.npmjs.com/package/relative): Get the relative filepath from path A to path B. Calculates from file-to-directory, file-to-file, directory-to-file,… [more](https://www.npmjs.com/package/relative) | [homepage](https://github.com/jonschlinkert/relative)

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/parse-filepath/issues/new).

## Building docs

Generate readme and API documentation with [verb](https://github.com/verbose/verb):

```sh
$ npm install verb && npm run docs
```

Or, if [verb](https://github.com/verbose/verb) is installed globally:

```sh
$ verb
```

## Running tests

Install dev dependencies:

```sh
$ npm install -d && npm test
```

## Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/parse-filepath/blob/master/LICENSE).

***

_This file was generated by [verb](https://github.com/verbose/verb), v, on March 29, 2016._

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