npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hlw-uni-mp/request

v1.0.25

Published

Universal Uni-App HTTP and upload client with RSA encryption & sign verification

Readme

@hlw-uni-mp/request

基于 uni-app 的极简轻量级 HTTP 请求与文件直传客户端,内置 RSA-2048 非对称加密与请求防篡改验签能力。

特性

  • 轻量易用:类似 Axios 的 API 设计,开箱即用,支持 Promise
  • 防篡改与安全:内置 RSA 公钥加密与 SHA-256 数据签名机制,无缝对接后端接口验签规范
  • 全平台设备采集:自动采集平台、系统、版本与网络状态并注入请求头
  • 拦截器支持:支持请求前拦截与响应后处理,方便统一注入 Token 或错误兜底
  • 并发防重与取消:支持 abortDuplicate 自动取消上一个相同参数的未完成重复请求
  • 失败自动重试:支持 retry(默认关闭),可全局或单个接口灵活开启与配置重试次数及延时
  • 自动加载遮罩:支持 loading 配置,自带并发计数锁,多请求并行时不闪烁、无残留
  • GET 内存缓存:支持 cache 内存缓存时间,极速复用高频静态数据
  • 文件直传支持:内置本地直传、阿里云 OSS 与七牛云直传能力
  • 强类型约束:全 TypeScript 编写,完备的类型推导与接口响应声明

安装

# pnpm
pnpm add @hlw-uni-mp/request

# npm
npm install @hlw-uni-mp/request

快速上手

1. 初始化网络配置

import { setupHttp } from "@hlw-uni-mp/request";

setupHttp({
    baseURL: "https://api.example.com",
    timeout: 15000,
    publicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...", // RSA 公钥
    secret: "your-sign-secret",                                    // 验签密钥
    getToken: () => uni.getStorageSync("token") || "",
    onUnauthorized: (msg) => {
        // 登录失效处理
    },
});

2. 接口请求调用

快捷方式(get / post / put / del)

import { get, post, request } from "@hlw-uni-mp/request";

// GET 请求
export function fetchUserInfo() {
    return get("/api/v1.user/info");
}

// POST 请求
export function submitOrder(data: { goodsId: number; num: number }) {
    return post("/api/v1.order/create", data);
}

// 通用 request
export function customRequest() {
    return request({
        url: "/api/v1.data/list",
        method: "POST",
        data: { page: 1 },
    });
}

客户端实例方式(http / client)

import { http } from "@hlw-uni-mp/request";

const response = await http.get("/api/v1.config");

3. 文件上传

import { uploadFile } from "@hlw-uni-mp/request";

const fileUrl = await uploadFile({
    biz: "avatar",
    filePath: tempFilePath,
});

License

MIT