package
Resolve npm package details, like name and base path, given an absolute path to a file inside a package
npm install module-details-from-pathGitHub-flavored package documentation.
Across all versions, last 30 days.
286,846,228 in 30 days
Runtime metadata.
Tagged topics.
Resolve npm package details, like name and base path, given an absolute path to a file inside a package.
npm install module-details-from-path --saveconst 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.
MIT
Estimated unpacked size across 1 packages.
3.9 kB
Includes dependencies.