Extracts the name of a package from its file path.
const getPackageName = require('get-package-name')
getPackageName('./project/node_modules/@babel/parser/lib/index.js') // @babel/parser
This is a Node.js package available through the npm registry. Before installing, download and install Node.js. Node.js 12 or higher is required.
Installation is done using the npm install command:
$ npm install --save-dev get-package-name
Returns the package name for the given module file path.
An absolute or relative path to a module.
The name of the folder in which packages are installed. Defaults to "node_modules"
.
This package is MIT licensed.