package
Get information on local packages.
npm install local-pkgGitHub-flavored package documentation.
Across all versions, last 30 days.
91,650,176 in 30 days
Runtime metadata.
Tagged topics.
Estimated unpacked size across 9 packages.
1.2 MB
Includes dependencies.
Get information on local packages.
npm i local-pkgimport {
getPackageInfo,
importModule,
isPackageExists,
resolveModule,
} from 'local-pkg'
isPackageExists('local-pkg') // true
isPackageExists('foo') // false
await getPackageInfo('local-pkg')
/* {
* name: "local-pkg",
* version: "0.1.0",
* rootPath: "/path/to/node_modules/local-pkg",
* packageJson: {
* ...
* }
* }
*/
// similar to `require.resolve` but works in ESM
resolveModule('local-pkg')
// '/path/to/node_modules/local-pkg/dist/index.mjs'
const { importModule } = await importModule('local-pkg')MIT License © 2021 Anthony Fu