{"id":15637655,"url":"https://github.com/doowb/npm-api","last_synced_at":"2025-04-05T06:10:02.752Z","repository":{"id":46084779,"uuid":"46145591","full_name":"doowb/npm-api","owner":"doowb","description":"Node.js library for getting info from NPM’s API","archived":false,"fork":false,"pushed_at":"2022-05-30T09:43:24.000Z","size":92,"stargazers_count":107,"open_issues_count":9,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T05:09:56.748Z","etag":null,"topics":["doowb","download-stats","downloads","maintainers","nodejs","npm","package","package-info","registry","stats"],"latest_commit_sha":null,"homepage":"https://github.com/doowb/npm-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doowb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-13T20:29:00.000Z","updated_at":"2024-11-30T05:44:23.000Z","dependencies_parsed_at":"2022-09-13T01:23:06.908Z","dependency_job_id":null,"html_url":"https://github.com/doowb/npm-api","commit_stats":null,"previous_names":["doowb/npm-info"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fnpm-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fnpm-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fnpm-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doowb%2Fnpm-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doowb","download_url":"https://codeload.github.com/doowb/npm-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294541,"owners_count":20915340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doowb","download-stats","downloads","maintainers","nodejs","npm","package","package-info","registry","stats"],"created_at":"2024-10-03T11:12:25.788Z","updated_at":"2025-04-05T06:10:02.734Z","avatar_url":"https://github.com/doowb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# npm-api [![NPM version](https://img.shields.io/npm/v/npm-api.svg?style=flat)](https://www.npmjs.com/package/npm-api) [![NPM monthly downloads](https://img.shields.io/npm/dm/npm-api.svg?style=flat)](https://npmjs.org/package/npm-api) [![NPM total downloads](https://img.shields.io/npm/dt/npm-api.svg?style=flat)](https://npmjs.org/package/npm-api) [![Linux Build Status](https://img.shields.io/travis/doowb/npm-api.svg?style=flat\u0026label=Travis)](https://travis-ci.org/doowb/npm-api)\n\n\u003e Node.js library for getting info from NPM’s API\n\nPlease consider following this project's author, [Brian Woodward](https://github.com/doowb), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save npm-api\n```\n\n## Usage\n\n```js\nvar NpmApi = require('npm-api');\n```\n\n## API\n\n### [NpmApi](index.js#L21)\n\nNpmApi constructor. Create an instance to work with maintainer and repository information.\n\n**Example**\n\n```js\nlet npm = new NpmApi();\n```\n\n### [.view](index.js#L58)\n\nCreate a new instance of `View` or get an existing instance to work with npm couchdb views.\n\n**Params**\n\n* `name` **{String}**: Name of the couchdb view to work with.\n* `returns` **{Object}** `View`: instance\n\n**Example**\n\n```js\nvar view = npm.view('byUser');\n```\n\n### [.list](index.js#L84)\n\nCreate a new instance of `List` or get an existing instance to work with npm couchdb list.\n\n**Params**\n\n* `name` **{String}**: Name of the couchdb list to work with.\n* `view` **{String|Object}**: Name or instance of a `view` to work with.\n* `returns` **{Object}** `List`: instance\n\n**Example**\n\n```js\nvar list = npm.list('sortCount', 'byUser');\n```\n\n### [.repo](index.js#L118)\n\nCreate an instance of a `repo` to work with.\n\n**Params**\n\n* `name` **{String}**: Name of the repo as it's published to npm.\n* `returns` **{Object}**: Instance of a `Repo` model to work with.\n\n**Example**\n\n```js\nvar repo =  npm.repo('micromatch');\n```\n\n### [.maintainer](index.js#L142)\n\nCreate an instance of a `maintainer` to work with.\n\n**Params**\n\n* `name` **{String}**: Npm username of the maintainer.\n* `returns` **{Object}**: Instance of a `Maintainer` model to work with.\n\n**Example**\n\n```js\nvar maintainer =  npm.maintainer('doowb');\n```\n\n## Models\n\n### [BaseModel](lib/models/base.js#L17)\n\nBase model to include common plugins.\n\n**Params**\n\n* `store` **{Object}**: Cache store instance to use.\n\n### [Maintainer](lib/models/maintainer.js#L19)\n\nMaintainer constructor. Create an instance of an npm maintainer by maintainer name.\n\n**Params**\n\n* `name` **{String}**: Name of the npm maintainer to get information about.\n\n**Example**\n\n```js\nconst maintainer = new Maintainer('doowb');\n```\n\n### [.repos](lib/models/maintainer.js#L43)\n\nGet the repositories owned by this maintainer.\n\n* `returns` **{Promise}**: Returns array of repository names when promise resolves.\n\n**Example**\n\n```js\nmaintainer.repos()\n  .then(function(repos) {\n    console.log(repos);\n  }, function(err) {\n    console.error(err);\n  });\n```\n\n### [Repo](lib/models/repo.js#L18)\n\nRepo constructor. Create an instance of an npm repo by repo name.\n\n**Params**\n\n* `name` **{String}**: Name of the npm repo to get information about.\n\n**Example**\n\n```js\nconst repo = new Repo('micromatch');\n```\n\n### [.package](lib/models/repo.js#L41)\n\nGet the repo's published package.json.\n\n* `returns` **{Promise}**: Returns the package.json object when promise resolves.\n\n**Example**\n\n```js\nrepo.package()\n  .then(function(pkg) {\n    console.log(pkg);\n  }, function(err) {\n    console.error(err);\n  });\n```\n\n### [.version](lib/models/repo.js#L73)\n\nGet the repo's published package.json value for the specified version.\n\n**Params**\n\n* `version` **{String}**: Specific version to retrieve.\n* `returns` **{Promise}**: Returns the package.json object for the specified version when promise resolves.\n\n**Example**\n\n```js\nrepo.version('0.2.0')\n  .then(function(pkg) {\n    console.log(pkg);\n  }, function(err) {\n    console.error(err);\n  });\n```\n\n### [.dependencies](lib/models/repo.js#L101)\n\nGet the repo's dependencies for the specified version.\n\n**Params**\n\n* `version` **{String}**: Specific version to retrieve. Defaults to `latest`.\n* `returns` **{Promise}**: Returns the dependencies object for the specified version when promise resolves.\n\n**Example**\n\n```js\nrepo.dependencies()\n  .then(function(dependencies) {\n    console.log(dependencies);\n  }, function(err) {\n    console.error(err);\n  });\n```\n\n### [.devDependencies](lib/models/repo.js#L122)\n\nGet the repo's devDependencies for the specified version.\n\n**Params**\n\n* `version` **{String}**: Specific version to retrieve. Defaults to `latest`.\n* `returns` **{Promise}**: Returns the devDependencies object for the specified version when promise resolves.\n\n**Example**\n\n```js\nrepo.devDependencies()\n  .then(function(devDependencies) {\n    console.log(devDependencies);\n  }, function(err) {\n    console.error(err);\n  });\n```\n\n### [.prop](lib/models/repo.js#L144)\n\nGet the specified property from the repo's package.json for the specified version.\n\n**Params**\n\n* `prop` **{String}**: Name of the property to get.\n* `version` **{String}**: Specific version to retrieve. Defaults to `latest`.\n* `returns` **{Promise}**: Returns the property for the specified version when promise resolves.\n\n**Example**\n\n```js\nrepo.prop('author')\n  .then(function(author) {\n    console.log(author);\n  }, function(err) {\n    console.error(err);\n  });\n```\n\n## Registry queries\n\n### [View](lib/view.js#L21)\n\nView constructor. Create an instance of a view associated with a couchdb view in the npm registry.\n\n**Params**\n\n* `name` **{String}**: Name of couchdb view to use.\n* `returns` **{Object}**: instance of `View`\n\n**Example**\n\n```js\nconst view = new View('dependedUpon');\n```\n\n### [.query](lib/view.js#L44)\n\nQuery the couchdb view with the provided parameters.\n\n**Params**\n\n* `params` **{Object}**: URL query parameters to pass along to the couchdb view.\n* `returns` **{Promise}**: Results of the query when promise is resolved.\n\n**Example**\n\n```js\nlet results = await view.query({\n  group_level: 2,\n  startkey: JSON.stringify(['micromatch']),\n  endkey: JSON.stringify(['micromatch', {}])\n});\n```\n\n### [.stream](lib/view.js#L89)\n\nQuery the couchdb view with the provided parameters and return a stream of results.\n\n**Params**\n\n* `params` **{Object}**: URL query parameters to pass along to the couchdb view.\n* `returns` **{Stream}**: Streaming results of the query.\n\n**Example**\n\n```js\nview.stream({\n  group_level: 2,\n  startkey: JSON.stringify(['micromatch']),\n  endkey: JSON.stringify(['micromatch', {}])\n})\n.on('data', (data) =\u003e {\n  console.log(data);\n});\n```\n\n### [.url](lib/view.js#L109)\n\nBuild a formatted url with the provided parameters.\n\n**Params**\n\n* `query` **{Object}**: URL query parameters.\n* `returns` **{String}**: formatted url string\n\n### [List](lib/list.js#L22)\n\nList constructor. Create an instance of a list associated with a couchdb list in the npm registry.\n\n**Params**\n\n* `name` **{String}**: Name of couchdb list to use.\n* `view` **{Object}**: Instance of a View to use with the list.\n* `returns` **{Object}**: instance of `List`\n\n**Example**\n\n```js\nlet list = new List('dependedUpon', view);\n```\n\n### [.query](lib/list.js#L42)\n\nQuery the couchdb list with the provided parameters.\n\n**Params**\n\n* `params` **{Object}**: URL query parameters to pass along to the couchdb list.\n* `returns` **{Promise}**: Results of the query when promise is resolved.\n\n**Example**\n\n```js\nlet results = await list.query({ key: JSON.stringify(['micromatch']) })\n```\n\n### [.url](lib/list.js#L59)\n\nBuild a formatted url with the provided parameters.\n\n**Params**\n\n* `query` **{Object}**: URL query parameters.\n* `returns` **{String}**: formatted url string\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\nPlease read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [base](https://www.npmjs.com/package/base): Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks | [homepage](https://github.com/node-base/base \"Framework for rapidly creating high quality, server-side node.js applications, using plugins like building blocks\")\n* [download-stats](https://www.npmjs.com/package/download-stats): Get and calculate npm download stats for npm modules. | [homepage](https://github.com/doowb/download-stats \"Get and calculate npm download stats for npm modules.\")\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 115 | [doowb](https://github.com/doowb) |  \n| 1   | [0xflotus](https://github.com/0xflotus) |  \n| 1   | [Hypnosphi](https://github.com/Hypnosphi) |  \n| 1   | [NachmanBerkowitz](https://github.com/NachmanBerkowitz) |  \n\n### Author\n\n**Brian Woodward**\n\n* [GitHub Profile](https://github.com/doowb)\n* [Twitter Profile](https://twitter.com/doowb)\n* [LinkedIn Profile](https://linkedin.com/in/woodwardbrian)\n\n### License\n\nCopyright © 2021, [Brian Woodward](https://github.com/doowb).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on January 20, 2021._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fnpm-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoowb%2Fnpm-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoowb%2Fnpm-api/lists"}