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

@mingto/obs-server

v1.0.40

Published

通用OBS文件上传

Readme

@mingto/obs-server

统一的 OBS 文件上传工具库,旨在简化并高效处理文件上传任务。该工具库会自动判断使用 @mingto/huawei-obs-server@mingto/aws-obs-server@mingto/minio-v2-obs-server 来完成上传操作。

特性

  • 🔄 自动适配:自动识别 OBS 类型并选择对应上传方式
  • 📦 统一接口:所有 OBS 类型使用相同的 API 接口
  • 🚀 支持大文件:自动分片上传
  • 📊 进度监控:实时上传进度回调
  • 取消上传:支持随时取消上传操作

安装

pnpm add @mingto/obs-server

快速开始

import obsServer from '@mingto/obs-server'

// 配置全局参数
obsServer.config({
  getToken: () => '用户的token',
  fileSplitThreshold: 1024 * 1024 * 5
})

// 创建要上传的文件对象
const sourceFile = new File(['hello world'], 'hello.txt', { type: 'text/plain' })

// 创建上传实例
const uploadContext = obsServer.create({
  sourceFile,
  onProgress: (event) => {
    console.log(`上传进度: ${event.percent}%`)
  },
  onSuccess: (event) => {
    console.log('上传成功:', event.fileInfo)
  },
  onError: (error) => {
    console.error('上传失败:', error)
  }
})

// 取消上传
// uploadContext.abort()

API

obsServer.config(options)

全局配置方法。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | getToken | () => string | 是 | 获取上传所需的 token | | fileSplitThreshold | number | 否 | 文件大小分隔线,默认 5MB |

obsServer.create(options)

创建上传实例。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | sourceFile | File | 是 | 要上传的文件对象 | | partSize | number | 否 | 分片大小,默认 5MB | | sceneId | '0' \| '1' | 否 | 上传桶的类型,'0' 为私有桶,'1' 为公共桶(默认) | | onStart | () => void | 否 | 上传开始回调 | | onProgress | (event) => void | 否 | 上传进度回调 | | onSuccess | (event) => void | 否 | 上传成功回调 | | onError | (error) => void | 否 | 上传失败回调 | | onAbort | () => void | 否 | 取消上传回调 | | onFinally | () => void | 否 | 上传结束回调 |

注意事项

  1. OBS 类型自动判断:工具库会调用后端 file/config 接口获取 OBS 类型

    • 返回 aws → 使用 @mingto/aws-obs-server
    • 返回 huawei → 使用 @mingto/huawei-obs-server
    • 返回 minio → 使用 @mingto/minio-v2-obs-server
  2. 参数配置:具体参数配置请参考对应工具库的文档

完整文档

更多详细用法请参考 官方文档

许可证

MIT