# module-details-from-path

> Resolve npm package details, like name and base path, given an absolute path to a file inside a package

Latest version **1.0.4** (published 2025-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install module-details-from-path
pnpm add module-details-from-path
yarn add module-details-from-path
bun add module-details-from-path
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2025-04-29 |
| First published | 2016-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Thomas Watson |
| Maintainers | watson |
| Keywords | node, nodejs, npm, module, package, extract, parse, name, basedir, directory, path, relative |

## Links

- npm: https://www.npmjs.com/package/module-details-from-path
- Repository: https://github.com/watson/module-details-from-path
- Homepage: https://github.com/watson/module-details-from-path#readme
- Issues: https://github.com/watson/module-details-from-path/issues
- npm.io page: https://npm.io/package/module-details-from-path

## 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.4 (latest) — 2025-04-29
- 1.0.3 — 2016-07-09
- 1.0.2 — 2016-02-09
- 1.0.1 — 2016-02-09
- 1.0.0 — 2016-02-09

## README

# module-details-from-path

Resolve npm package details, like name and base path, given an absolute path to a file inside a package.

[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)

## Installation

```
npm install module-details-from-path --save
```

## Usage

```js
const assert = require('assert')
const parse = require('module-details-from-path')

const path = '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube/bin/tube.js'

assert.deepStrictEqual(parse(path), {
  name: 'picture-tube',
  basedir: '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube',
  path: 'bin/tube.js'
})
```

Returns `undefined` if module details cannot be found.

## License

MIT

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