当前位置:网站首页>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,获取包下载量
边栏推荐
- 有趣插件汇总
- 判断js对象是否为空的方式
- Common questions and answering skills of project manager interview
- 左值引用和右值引用
- 《大厂面试》之JVM篇21问与答
- 基于开源流批一体数据同步引擎ChunJun数据还原—DDL解析模块的实战分享
- Lumiprobe染料酰肼丨BDP FL 酰肼方案
- Is it safe to open an account for online stock trading!?
- What are database OLAP and OLTP? Same and different? Applicable scenarios
- 亚马逊在阿拉伯联合酋长国限制LGBTQ相关的搜索和产品销售
猜你喜欢
1. Introduction to generating countermeasures network
大神详解开源 BUFF 增益攻略丨直播
二叉查找树(一) - 概念与C语言实现
Document contains & conditional competition
Analysis of breakpoint continuation and download principle
Lumiprobe copper free click chemical solution
谈谈内联函数
Testing principle and precautions of biovendor rage ELISA Kit
哈夫曼树(一)基本概念与C语言实现
PHP require/include 区别
随机推荐
Peking University ACM problems 1003:hangover
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
基于开源流批一体数据同步引擎ChunJun数据还原—DDL解析模块的实战分享
Is the project manager a leader? Can you criticize and blame members?
AVL balanced binary tree (I) - concept and C language implementation
Notes on modification of Jerry's test box pairing software [chapter]
Jerry's touch key recognition process [chapter]
Maya house modeling
Amazon restricts LGBTQ related search and product sales in the United Arab Emirates
Study on PEGylation of lumiprobe and PEG linker - iodine-peg3-acid
Basic concepts of tree
MFC界面库BCGControlBar v33.0 - 桌面警报窗口、网格控件升级等
uniapp怎么上传二进制图片
Dynamic style binding --style and class
北京大学ACM Problems 1001:Exponentiation
1、生成对抗网络入门
有趣插件汇总
Lumiprobe copper free click chemical solution
Peking University ACM problems 1000:a+b problem
obsidian配合hugo的使用,让markdown本地编辑软件与在线化无缝衔接