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

qyx-volcegine-tos

v0.0.7

Published

基于@volcengine/tos-sdk的二次封装

Readme

QyxVolcegineTos

npm version license

一个用于在浏览器和 Node.js 环境中,便捷地上传文件至火山引擎对象存储(TOS)的客户端 SDK。

📦 安装

根据你的项目环境,选择以下一种方式安装:

使用 npm:

npm install qyx-volcegine-tos --save

使用 yarn:

yarn add qyx-volcegine-tos

使用 CDN:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/qyx-volcegine-tos.min.js"></script>

🚀 使用

普通上传

// 如果你通过包管理器安装并使用模块化开发
import QyxVolcegineTos from 'qyx-volcegine-tos';
// 或使用 CommonJS: const QyxVolcegineTos = require('qyx-volcegine-tos');

// 初始化实例 (请替换为你的真实配置)
const client = new QyxVolcegineTos({
  getOptions() => async () => {
  const result = await fetch("https://api.example.com/xxx").catch(() => {
            });
            return {
                // yourRegion填写Bucket所在地域。以华东1(杭州)为例,yourRegion填写为oss-cn-hangzhou。
                region: result.region,
                // 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
                accessKeyId: result.accessKeyId,
                accessKeySecret: result.accessKeySecret,
                // 从STS服务获取的安全令牌(SecurityToken)。
                securityToken: result.securityToken,
                // 填写Bucket名称。
                bucket: result.bucket,
                // 填写域名地址
                endpoint: result.endpoint,
                // 填写 Bucket 所在地域。以华北2(北京)为例,"Provide your region" 填写为 cn-beijing。
                region: result.region,
                ...
            };
    }
});

// 执行上传
async function uploadFile() {
  try {
    // fileName 文件路径
    // file 文件
    // config 配置
    const result = await client.putObject(fileName, file, config);
    console.log('上传成功!', result);
  } catch (error) {
    console.error('上传失败:', error);
  }
}

返回

{
  "code": 200,
  "data": {
    "url": "https://bucket.region.tos.volces.com/path/to/file.jpg",
    "suffix": "jpg",
    "uploadId": "your-multipart-upload-id",
    "meta": {
      // 来自服务器或你上传时提供的原文件元信息
    }
  }
}

断点续传

async function multipartUpload() {
  try {
    const taskId = await client.addMultipartUpload(fileName, file, {
        progress: function(p, checkpoint) {}
    }
    );
    const result = await client.startUpload(taskId)
    console.log('上传成功!', result);
  } catch (error) {
    console.error('上传失败:', error);
  }
}

断点续传暂停

async function pauseUpload(taskId) {
    await client.pause(taskId)
}

断点续传恢复

async function resumeUpload(abortCheckpoint, file) {
  try {
    const taskId = await client.addMultipartUpload(abortCheckpoint.key, file, {
        checkpoint: abortCheckpoint,
        progress: function(p, checkpoint) {}
    }
    );
    const result = await client.startUpload(taskId)
    console.log('上传成功!', result);
  } catch (error) {
    console.error('上传失败:', error);
  }
}

断点续传取消

async function cancUpload(abortCheckpoint,taskId) {
    await client.cancel(abortCheckpoint.name, abortCheckpoint.uploadId, taskId)
}