![Malicious npm Package Typosquats react-login-page to Deploy Keylogger](https://cdn.sanity.io/images/cgdhsj6q/production/007b21d9cf9e03ae0bb3f577d1bd59b9d715645a-1024x1024.webp?w=400&fit=max&auto=format)
Research
Security News
Malicious npm Package Typosquats react-login-page to Deploy Keylogger
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
npm-api
Advanced tools
Readme
Base class for retrieving data from the npm registry.
Install with npm:
$ npm install --save npm-api
var NpmApi = require('npm-api');
NpmApi constructor. Create an instance to work with maintainer and repository information.
Example
var npm = new NpmApi();
Create a new instance of View
or get an existing instance to work with npm couchdb views.
Example
var view = npm.view('byUser');
Params
name
{String}: Name of the couchdb view to work with.returns
{Object} View
: instanceCreate a new instance of List
or get an existing instance to work with npm couchdb list.
Example
var list = npm.list('sortCount', 'byUser');
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
: instanceCreate an instance of a repo
to work with.
Example
var repo = npm.repo('micromatch');
Params
name
{String}: Name of the repo as it's published to npm.returns
{Object}: Instance of a Repo
model to work with.Create an instance of a maintainer
to work with.
Example
var maintainer = npm.maintainer('doowb');
Params
name
{String}: Npm username of the maintainer.returns
{Object}: Instance of a Maintainer
model to work with.Base model to include common plugins.
Params
store
{Object}: Cache store intance to use.Maintainer constructor. Create an instance of an npm maintainer by maintainer name.
Example
var maintainer = new Maintainer('doowb');
Params
name
{String}: Name of the npm maintainer to get information about.store
{Object}: Optional cache store instance for caching results. Defaults to a memory store.Get the repositories owned by this maintainer.
Example
maintainer.repos()
.then(function(repos) {
console.log(repos);
}, function(err) {
console.error(err);
});
returns
{Promise}: Returns array of repository names when promise resolves.Repo constructor. Create an instance of an npm repo by repo name.
Example
var repo = new Repo('micromatch');
Params
name
{String}: Name of the npm repo to get information about.store
{Object}: Optional cache store instance for caching results. Defaults to a memory store.Get the repo's published package.json.
Example
repo.package()
.then(function(pkg) {
console.log(pkg);
}, function(err) {
console.error(err);
});
returns
{Promise}: Returns the package.json object when promise resolves.Get the repo's published package.json value for the specified version.
Example
repo.version('0.2.0')
.then(function(pkg) {
console.log(pkg);
}, function(err) {
console.error(err);
});
Params
version
{String}: Specific version to retrieve.returns
{Promise}: Returns the package.json object for the specified version when promise resolves.Get the repo's dependencies for the specified version.
Example
repo.dependencies()
.then(function(dependencies) {
console.log(dependencies);
}, function(err) {
console.error(err);
});
Params
version
{String}: Specific version to retrieve. Defaults to latest
.returns
{Promise}: Returns the dependencies object for the specified version when promise resolves.Get the repo's devDependencies for the specified version.
Example
repo.devDependencies()
.then(function(devDependencies) {
console.log(devDependencies);
}, function(err) {
console.error(err);
});
Params
version
{String}: Specific version to retrieve. Defaults to latest
.returns
{Promise}: Returns the devDependencies object for the specified version when promise resolves.Get the specified property from the repo's package.json for the specified version.
Example
repo.prop('author')
.then(function(author) {
console.log(author);
}, function(err) {
console.error(err);
});
Params
prop
{String}: Name of the property to get.version
{String}: Specific version to retrieve. Defaults to latest
.returns
{Promise}: Returns the property for the specified version when promise resolves.View constructor. Create an instance of a view associated with a couchdb view in the npm registry.
Example
var view = new View('dependedUpon');
Params
name
{String}: Name of couchdb view to use.returns
{Object}: instance of View
Query the couchdb view with the provided parameters.
Example
view.query({ group_level: 2, startkey: JSON.stringify(['micromatch']), endkey: JSON.stringify(['micromatch', {}])})
.then(function(results) {
console.log(results);
}, function(err) {
console.log(err);
});
Params
params
{Object}: URL query parameters to pass along to the couchdb view.returns
{Promise}: Results of the query when promise is resolved.Query the couchdb view with the provided parameters and return a stream of results.
Example
view.stream({ group_level: 2, startkey: JSON.stringify(['micromatch']), endkey: JSON.stringify(['micromatch', {}])})
.on('data', function(data) {
console.log(data);
});
Params
params
{Object}: URL query parameters to pass along to the couchdb view.returns
{Stream}: Streaming results of the query.Build a formatted url with the provided parameters.
Params
params
{Object}: URL query parameters.returns
{String}: formatted url stringList constructor. Create an instance of a list associated with a couchdb list in the npm registry.
Example
var list = new List('dependedUpon', view);
Params
name
{String}: Name of couchdb list to use.view
{Object}: Instance of a View to use with the list.returns
{Object}: instance of List
Query the couchdb list with the provided parameters.
Example
list.query({ key: JSON.stringify(['micromatch']) })
.then(function(results) {
console.log(results);
}, function(err) {
console.log(err);
});
Params
params
{Object}: URL query parameters to pass along to the couchdb list.returns
{Promise}: Results of the query when promise is resolved.Build a formatted url with the provided parameters.
Params
params
{Object}: URL query parameters.returns
{String}: formatted url stringPull requests and stars are always welcome. For bugs and feature requests, please create an issue.
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && 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-generate-readme, v0.2.0, on November 13, 2016.
FAQs
Unknown package
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.
Research
Security News
Socket researchers unpack a typosquatting package with malicious code that logs keystrokes and exfiltrates sensitive data to a remote server.
Security News
The JavaScript community has launched the e18e initiative to improve ecosystem performance by cleaning up dependency trees, speeding up critical parts of the ecosystem, and documenting lighter alternatives to established tools.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.