Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
The npm-api package provides a simple interface to interact with the npm registry programmatically. It allows users to fetch information about packages, users, and other entities on the npm registry.
Get Package Information
This feature allows you to fetch detailed information about a specific npm package. In this example, it retrieves information about the 'express' package.
const NpmApi = require('npm-api');
const repo = new NpmApi().repo('express');
repo.package().then(pkg => console.log(pkg));
Get User Information
This feature allows you to fetch information about a specific npm user. In this example, it retrieves information about the user 'isaacs'.
const NpmApi = require('npm-api');
const user = new NpmApi().user('isaacs');
user.info().then(info => console.log(info));
Search for Packages
This feature allows you to search for packages on the npm registry. In this example, it searches for packages related to 'express'.
const NpmApi = require('npm-api');
const npm = new NpmApi();
npm.search('express').then(results => console.log(results));
The npm-registry-fetch package provides a low-level interface to interact with the npm registry. It is more flexible and allows for more customized requests compared to npm-api, but it requires more setup and understanding of the npm registry API.
The package-json package allows you to get metadata of a package from the npm registry. It is simpler and more focused on fetching package information compared to npm-api, which offers a broader range of functionalities.
The npm package itself can be used programmatically to interact with the npm registry. It provides a comprehensive set of features but is more complex to use compared to npm-api, which offers a more streamlined and simplified interface.
Base class for retrieving data from the npm registry.
Install with npm:
$ npm install npm-api --save
var NpmInfo = require('npm-api');
NpmInfo constructor. Create an instance to work with maintainer and repository information.
Example
var npm = new NpmInfo();
Create a new instance of View
or get an existing instance to work with npm couchdb views.
Params
name
{String}: Name of the couchdb view to work with.returns
{Object} View
: instanceExample
var view = npm.view('byUser');
Create a new instance of List
or get an existing instance to work with npm couchdb list.
Params
name
{String}: Name of the couchdb list to work with.view
{String|Object}: Name or instance of a view
to work with.returns
{Object} List
: instanceExample
var list = npm.list('sortCount', 'byUser');
Create an instance of a repo
to work with.
Params
name
{String}: Name of the repo as it's published to npm.returns
{Object}: Instance of a Repo
model to work with.Example
var repo = npm.repo('micromatch');
Create an instance of a maintainer
to work with.
Params
name
{String}: Npm username of the maintainer.returns
{Object}: Instance of a Maintainer
model to work with.Example
var maintainer = npm.maintainer('doowb');
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
$ npm install verb && npm run docs
Or, if verb is installed globally:
$ verb
Install dev dependencies:
$ npm install -d && npm test
Brian Woodward
Copyright © 2016 Brian Woodward Released under the MIT license.
This file was generated by verb, v0.9.0, on March 23, 2016.
[0.4.13] - 2019-06-17
'all'
to this.package()
to ensure all versions are pulled when searching for a specific version.FAQs
Node.js library for getting info from NPM’s API
The npm package npm-api receives a total of 297,400 weekly downloads. As such, npm-api popularity was classified as popular.
We found that npm-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.