Query npmjs registry via api

2019-03-08 19:30发布

I find I'm often unsatisfied with the ordering and expressiveness of searches on https://www.npmjs.com/. I guess there should be a way to programmatically query the server using https://api.npmjs.org/ or http://registry.npmjs.org/. But how? Where is the documentation?

(Or are there node packages to faciliate that? I know SO isn't about tool or package recommendations, so perhaps I shouldn't be asking about this as well, but if there were some tool, I could likely read the API from that as well.)

7条回答
老娘就宠你
2楼-- · 2019-03-08 20:28

Take a look at sinopia registry interface: https://github.com/rlidwka/sinopia/blob/master/lib/index-api.js. The default registry for npm client is https://registry.npmjs.org (try it out on console: npm config ls -l). So you can try the following (referencing the sinopia API) to fetch data about react 15.0.2

https://registry.npmjs.org/react/15.0.2

查看更多
登录 后发表回答