Skip to content

oxtaa/package-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

package-fetcher

Designed to fetch information directly from the NPM registry for other NPM packages.

Table of contents

Installation

npm install package-fetcher

Example

const package = require('package-fetcher');

(async () => {
    const data = await package.fetchInfo('moment');
    console.log(data.name);
    console.log(data.description);
})();

Properties

  • .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.

Keep in mind that

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.

About

Designed to fetch information directly from the NPM registry for other NPM packages.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors