Designed to fetch information directly from the NPM registry for other NPM packages.
npm install package-fetcherconst package = require('package-fetcher');
(async () => {
const data = await package.fetchInfo('moment');
console.log(data.name);
console.log(data.description);
})();- .name - Returns the package name.
- .description - Returns the package description.
- .author - Returns the package author.
- .maintainers - Returns the package maintainers.
- .version - Returns the latest package version.
- .keywords - Returns the package keywords.
- .downloads - Returns download counts (for the last week, last month, and last year)
- .lastWeek - Only returns the download count from the last 7 days.
- .lastMonth - Only returns the download count from the last month.
- .lastYear - Only returns the download count from the last year.
- .created - Returns the time when package was created (both ISO and timestamp)
- .iso - Returns the ISO time when package was created
- .timestamp - Returns the timestamp when package was created
- .modified - Returns the time when package was last modified (both ISO and timestamp)
- .iso - Returns the ISO time when package was last modified
- .timestamp - Returns the timestamp when package was last modified
However, if you don't specify a property it will return the entire JSON.
Occasionally, the package may encounter failures when attempting to fetch package information from the NPM registry, this is a bug that i'll try to solve for future updates.