当前位置:网站首页>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,获取包下载量
边栏推荐
- Basic concepts of tree
- Peking University ACM problems 1005:i think I need a houseboat
- 哈夫曼树(一)基本概念与C语言实现
- 北京大学ACM Problems 1001:Exponentiation
- What are database OLAP and OLTP? Same and different? Applicable scenarios
- Comparison between QT and other GUI Libraries
- Game 81 biweekly
- Scene 299
- 判断js对象是否为空的方式
- Mistakes the project manager should not make
猜你喜欢

NLP paper lead reading | what about the degradation of text generation model? Simctg tells you the answer

PHP obtains opcode and C source code

SQL优化

【微服务~Nacos】Nacos之配置中心

PHP获取Opcode及C源码

Lumiprobe 改性三磷酸盐丨生物素-11-UTP研究

谈谈内联函数

By analyzing more than 7million R & D needs, it is found that these eight programming languages are the most needed by the industry

uniapp怎么上传二进制图片

Maya House Modeling
随机推荐
B_QuRT_User_Guide(31)
树基本概念
How can I get the stock account opening discount link? In addition, is it safe to open a mobile account?
Jerry's touch key recognition process [chapter]
Halcon knowledge: check the measurement objects [1]
Lumiprobe copper free click chemical solution
Originpro 2021 with installation tutorial
Heartbeat and DRBD configuration process
北京大学ACM Problems 1003:Hangover
A complete collection of vulnerability scanning tools. Mom doesn't have to worry that I won't find any more vulnerabilities
C file pointer
maya房子建模
Study on PEGylation of lumiprobe and PEG linker - iodine-peg3-acid
DEX文件解析 - method_ids解析
断点续传和下载原理分析
RP原型资源分享-购物类App
Go学习笔记
C文件指针
Lumiprobe protein quantitation - qudye Protein Quantitation Kit
动态样式绑定--style 和 class