module-details-from-path (1.0.4)
Published 2026-02-24 14:01:35 +00:00 by atheaadmin
Installation
registry=npm install module-details-from-path@1.0.4"module-details-from-path": "1.0.4"About this package
module-details-from-path
Resolve npm package details, like name and base path, given an absolute path to a file inside a package.
Installation
npm install module-details-from-path --save
Usage
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
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| bench-node | ^0.5.4 |
| standard | ^15.0.1 |
| tape | ^4.6.0 |
Keywords
node
nodejs
npm
module
package
extract
parse
name
basedir
directory
path
relative