当前位置:网站首页>qiao-npms:搜索npm包
qiao-npms:搜索npm包
2022-06-30 20:29:00 【uikoo9】

【前言】
另一个常见的需求是搜索某个npm包,获取返回的信息,类似上图
【搜索npm包信息】
npm 官方没有对外的api,但是有封装好的npm包,
https://github.com/npm/cli/tree/latest/workspaces/libnpmsearch
这个npm包基于另一个npm包,
GitHub - npm/npm-registry-fetch: like fetch() but for the npm registry
后者是npm几个工具包的基础,封装了npm请求api相关的方法,有兴趣可以看下
于search包同级的还有很多包,例如access,fund,hook等
详见:https://github.com/npm/cli/tree/latest/workspaces

【qiao-npms】
封装了search相关的方法,传入包名即可,
默认limit了3条返回,按流行度排序,也可以自己传入options
'use strict';
var q = require('qiao-npms');
var test = async function(){
try{
var packageName = 'qiao-cos';
var res = await q.searchPackages(packageName);
console.log(res);
}catch(e){
console.log(e);
}
};
test();return
[
{
name: 'qiao-cos',
scope: 'unscoped',
version: '0.4.3',
description: 'tencent cos upload tool on nodejs',
keywords: [ 'tencent', 'cos', 'upload', 'tool', 'nodejs' ],
date: 2022-06-13T08:06:26.354Z,
links: {
npm: 'https://www.npmjs.com/package/qiao-cos',
homepage: 'https://github.com/uikoo9/qiao-monorepo/tree/master/packages/qiao-cos#readme',
repository: 'https://github.com/uikoo9/qiao-monorepo',
bugs: 'https://github.com/uikoo9/qiao-monorepo/issues'
},
author: { name: 'uikoo9', email: '[email protected]' },
publisher: { username: 'npm_insistime', email: '[email protected]' },
maintainers: [ [Object] ]
}
]【获取包下载量】
qiao-npms,还封装了获取某个包的下载量方法,
详见:qiao-npms:获取npm包下载量_uikoo9的博客-CSDN博客
【总结】
1.qiao-npms,搜索npm包信息
2.qiao-npms,获取包下载量
边栏推荐
- The Commission is so high that everyone can participate in the new programmer's partner plan
- Lumiprobe biotin phosphimide (hydroxyproline) instructions
- Summary of PHP file upload (garbled code, move failure, permission, display picture)
- Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing
- Lumiprobe蛋白质定量丨QuDye 蛋白定量试剂盒
- Golang应用 ━━ 安装、配置与使用hugo博客系统
- Build your own website (20)
- Heartbeat uses NFS to make MySQL highly available based on CRM
- 哈夫曼树(一)基本概念与C语言实现
- Study on PEGylation of lumiprobe and PEG linker - iodine-peg3-acid
猜你喜欢

Lumiprobe染料酰肼丨BDP FL 酰肼方案

Maya House Modeling

Lumiprobe生物素亚磷酰胺(羟脯氨酸)说明书

基于开源流批一体数据同步引擎ChunJun数据还原—DDL解析模块的实战分享

PHP require/include 区别

Lumiprobe蛋白质定量丨QuDye 蛋白定量试剂盒

uniapp-富文本编辑器

Binary search tree (1) - concept and C language implementation

RP原型资源分享-购物类App

By analyzing more than 7million R & D needs, it is found that these eight programming languages are the most needed by the industry
随机推荐
Based on the open source stream batch integrated data synchronization engine Chunjun data restore DDL parsing module actual combat sharing
uniapp-路由uni-simple-router
Lumiprobe copper free click chemical solution
Jerry's question about long press boot detection [chapter]
1. Introduction to generating countermeasures network
How do I get the largest K massive data
二叉查找树(一) - 概念与C语言实现
Huffman tree (I) basic concept and C language implementation
What bank card do you need to open an account online? In addition, is it safe to open an account online now?
Lumiprobe protein quantitation - qudye Protein Quantitation Kit
The newly born robot dog can walk by himself after rolling for an hour. The latest achievement of Wu Enda's first disciple
Black apple server system installation tutorial, black apple installation tutorial, teach you how to install black apple in detail [easy to understand]
偏向锁/轻量锁/重级锁锁锁更健康,上锁解锁到底是怎么完成实现的
哈夫曼树(一)基本概念与C语言实现
数据库 OLAP、OLTP是什么?相同和不同?适用场景
C file pointer
Lumiprobe nucleic acid quantitative qudye dsDNA br detection kit
Peking University ACM problems 1003:hangover
uniapp-第三方网络请求
北京大学ACM Problems 1001:Exponentiation