1

I want to search in the npm registry for packages from my node app, but I couldn't find a documented/official way to search programatically. Of course I could just use https://www.npmjs.com/search?q=, but I rather not parse the HTML you'll get in return.

Is there a way to search the npm registry and get a JSON in return? Or do I have to use a third-party site, like https://api.npms.io/v2/search?

Sebastian Sebald
  • 16,130
  • 5
  • 62
  • 66
  • 1
    Have a look on this question http://stackoverflow.com/questions/34071621/query-npmjs-registry-via-api – styopdev Nov 02 '16 at 08:10
  • Only if the answer is that there is no such option :-/ – Sebastian Sebald Nov 02 '16 at 09:13
  • You can search for a particular package - https://replicate.npmjs.com/"package-name". This returns a json, as you wanted. Similarly, for all_docs - https://replicate.npmjs.com/_all_docs?include_docs=true gives you a json containing the docs of all of the packages. Also look at the question @styopdev provided, which gives more information. – R4444 Feb 08 '19 at 05:52

1 Answers1

2

Depending on how much info you need, https://www.npmjs.com/search/suggestions?q= might be enough.

Example: https://www.npmjs.com/search/suggestions?q=koa

pepkin88
  • 2,742
  • 20
  • 19