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

ctcqcos

v0.0.4

Published

cos to upload file

Downloads

9

Readme

ctcqcos

上传文件到腾讯云存储的自用库,主要用到COS服务的Node.js SDK v5版本

  npm install --save ctcqcos

然后在文件中先使用下面语句,再接着用方法。

  const ctcqcos = require('ctcqcos')
  const qcos = new ctcqcos({
    AppId: '***',
    SecretId: '***',
    SecretKey: '***',
    Bucket: '***',
    Region: '***',
  })

上传文件

qcos.upload(req, res, single, bucket)

  由于upload用到了multer,所以 req 和 res 是必要参数,本人写API经常用到的。    
  single(string):  是Bucket里面的文件夹名,指定要传到哪个文件夹里,在form-data中上传文件的key也要为single的值(必要)    
  bucket(string):  如果要上传到 和new ctcqcos()的Bucket 不一样时用到(可选)    

qcos.uploadPath(filePath, single, bucket)

  filePath(string):  文件在本地的路径(必要),    
  single:  同上(必要),    
  bucket:  同上(可选),    

qcos.uploadStream(streamParams, single, bucket)

  streamParams(object): {  (必要)    
    fileStream(string): 文件的buffer,    
    fileType(string): 文件的类型(.后缀名),    
  },     
  single:  同上(必要),    
  bucket:  同上(可选),    

删除上传的文件

qcos.deleteKey(url, bucket)

  url(string):  上传成功后返回的url(必要),
  bucket:  同上(可选),    

获取存储空间列表

qcos.serviceGet()

请求操作权限(xml)

qcos.authGet(authParams)

  authParams(object): {  (必要)    
    Method(string): http方法(get, post, delete, head),    
    Key(string): 文件名(包括文件夹路径),    
    Bucket(string): 和new ctcqcos()的Bucket 不一样时用到,    
  }   

验证Bucket

qcos.headBucket(bucket)

获取Bucket

qcos.getBucket(bucket)

创建Bucket

qcos.putBucket(bucket)

注: 创建后为私有读写,只能去腾讯云存储上改成公有的权限。

删除Bucket

qcos.deleteBucket(bucket)

注: 删除Bucket需要整个Bucket为空,否则删除失败。