Get information about a NPM package directly from the registry
npm install package-fetcher@latest
const package = require('package-fetcher');
package.get('moment').then(info => {
console.log(info.name, info.description)
}).catch(error => {
console.log('An error ocurred!', error)
});
-
get(
package name
) - Get information about the latest version of a package -
getDependencies(
package name
) - Get the dependencies (or dev dependencies) of a NPM package -
search(
search term, limit?
) - Get different NPM packages by searching for keywords in the registry. If you don't specify a limit, it will return the default number of results (20)