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

blz_oss_upload

v1.2.4

Published

基于阿里云(ali-oss)完成文件分片上传、普通文件上传、上传进度显示、取消上传等功能的文件上传工具

Readme

BLZ_npm_package

sdk介绍

blz_oss_upload是基于aliyun("ali-oss": "^6.23.0")的oss上传sdk的自主开发,sdk支持普通文件上传,分片文件上传,文件上传进度显示,中途取消文件上传等等主要上传功能。

文件上传权限和文件上传目录、地址等相关介绍

因阿里云oss上传涉及到权限校验,sdk需要配置阿里云的accessKeyId和accessKeySecret,本sdk内部已经集成了权限校验的接口调用,当然用户也可以在sdk外部获取权限相关参数直接传入到sdk内部。

sdk内部集成权限接口调用方式

import { OSSClient } from 'blz_oss_upload';

this.ossUploader = new OSSClient({
  uploadFileInfo,
  version,
  catalog,
  token,
  permissionUrl,
  getProcress:(progressNum) => {
        console.log('分片上传进度',progressNum) ;
  },
  callback: ({ res: { requestUrls }, status }) => {
    console.log('oss上传成功返回oss地址',requestUrls);
    console.log(status);

  },
});

this.ossUploader.getClientOSSAccess();
  • ossUploader: 为sdk内部封装的oss上传类,取消上传时需要对其进行操作;
  • uploadFileInfo: 为上传文件信息,包含上传文件名称、上传文件大小、上传文件路径、上传文件类型、上传文件md5值、上传文件分片数、上传文件分片大小等信息;
  • version: 为上传文件版本信息字符串,可以用来区分oss上传地域是国内还是国外,0开头表示国内,1开头表示国外;为null则默认使用国内oss上传地址;
  • catalog: 为上传文件目录字符串,上传文件目录为空则默认使用根目录;
  • token: 为调用获取accessKeyId和accessKeySecret的接口调用token;
  • permissionUrl: 为调用获取accessKeyId和accessKeySecret的接口调用地址;
  • getProcress: 为上传文件进度回调函数,上传文件进度回调函数会返回上传进度百分比;
  • callback: 为上传文件回调函数,上传文件回调函数会返回上传文件结果,上传文件结果为上传文件成功与否以及上传文件成功与否的状态码;

permissionUrl 权限接口字段结构

{
    "bucketName": "blzoss-usa-test",
    "endpoint": "oss-accelerate.aliyuncs.com",
    "AccessKeyId": "xxxx",
    "AccessKeySecret": "xxxxx",
    "domain": "https://blzoss-usa-test.oss-accelerate.aliyuncs.com/",
    "Expiration": "2026-04-07T09:25:24Z",
    "rootPath": "test",
    "region": "oss-us-east-1"
}

 bucketName 必要字段,对应oss中bucket名称
 AccessKeyId 必要字段,对应oss中accessKeyId
 AccessKeySecret 必要字段,对应oss中accessKeySecret
 domain 必要字段,对应oss中endpoint
 stsToken 必要字段,对应oss中SecurityToken
 region 必要字段,对应oss中region

sdk调用方式(不含权限接口调用)


this.ossUploader = new OSSClient({
  bucketName,
  AccessKeyId,
  AccessKeySecret,
  SecurityToken,
  domain,
  region,
  fileUrl,
  uploadFileInfo,
  getProcress:(progressNum) => {
        console.log('分片上传进度',progressNum) ;
  },
  callback: ({ res: { requestUrls }, status }) => {
    console.log('oss上传成功返回oss地址',requestUrls);
    console.log(status);

  },
});
this.ossUploader.clientOSSUpload();


fileUrl 为上传文件地址

sdk取消上传方式

this.ossUploader.cancelUpload();