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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@licq/cos

v2.1.5

Published

封装腾讯cos上传相关的方法

Downloads

11

Readme

@licq/cos

基于腾讯 cos nodesdk, 封装批量上传方法,特点是简单,并发效率高

NPM version NPM downloads

安装

npm i --save-dev @licq/cos

API

Cos

腾讯云对象存储cos上传

Returns: instanceof COS
Since: v2.0.0

| Param | Type | Description | | --- | --- | --- | | Config | Object | 对象存储参数 参考:https://cloud.tencent.com/document/product/436/8629#.E9.85.8D.E7.BD.AE.E9.A1.B9 | | Config.SecretId | String | 必填 | | Config.SecretKey | String | 必填 | | Config.CosObjectConfig | Object | 参见 https://cloud.tencent.com/document/product/436/64980#.E7.AE.80.E5.8D.95.E4.B8.8A.E4.BC.A0.E5.AF.B9.E8.B1.A1 中的参数说明 | | Config.CosObjectConfig.Bucket | String | 必填 | | Config.CosObjectConfig.Region | String | 必填 | | Config.CosObjectConfig.ACL | String | 可选 默认:'public-read' | | Config.ExtConfig | Object | 可选 本工具自定义参数 | | Config.ExtConfig.Domain | String | 可选 上传后的域名 默认:https://{Bucket}.cos.{Region}.myqcloud.com |

Example

const Cos = require('@licq/cos');
const cos = new Cos({
   SecretId: "SECRET_ID",
   SecretKey: "SECRET_KEY",
   CosObjectConfig: {
      Bucket: "test-12345678",
      Region: "ap-guangzhou",
      ACL: 'default'
   },
   ExtConfig: {
      Domain: 'https://demos.gtimg.cn/',
   }
});

await cos.uploadFiles(__dirname, 'ost/cos/demo');

cos.uploadFiles(localPath, cosPath)

批量上传

Returns: Promise

| Param | Type | Description | | --- | --- | --- | | localPath | String | 本地文件/目录的绝对路径 | | cosPath | String | cos的path |

cos.uploadFileByData(cosPath, fileData)

通过文件数据上传

Returns: Promise<>
Since: v2.1.3

| Param | Type | Description | | --- | --- | --- | | cosPath | String | cos路径 | | fileData | Buffer | String | Stream | 文件数据 |