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

alidaodao-cos-uploader

v1.0.4

Published

upload file to tencent cos for all node project

Downloads

17

Readme

alidaodao-cos-uploader

项目打包完成后将对应的文件上传腾讯COS上,并且可以刷新对应的CDN目录。

说明

  • 上传的时候,会自动清理远程bucket中的多余文件,请谨慎使用!

  • 更新 CDN缓存需要授权,如果使用子账号,请同时赋予该账号此权限!

  • 目前仅支持上传全量文件到腾讯云COS上,本次没有进行文件的MD5比对,后期如果需要会加入对应功能

  • 目前仅支持COS,后期有需要可以兼容到阿里云OSS和AWS的S3等对象存储

安装方法

npm install alidaodao-cos-uploader --save

配置

//上传文件并且刷新cdn
var qCosSDK = require("alidaodao-cos-uploader");
const config = {
    secretKey: '',
    secretId: '',
    bucket: '',
    region: 'ap-beijing',
    distPath: 'dist',
    targetPath: '',
    enableCdn: true,
    cdnUrl: ['https://abc.com/', 'https://www.abc.com/'],
};
qCosSDK.putObjectsToCos(config);

//仅刷新CDN
var qCosSDK = require("alidaodao-cos-uploader");
const config = {
    secretKey: '',
    secretId: '',
    enableCdn: true,
    cdnUrl: ['https://abc.com/', 'https://www.abc.com/'],
};
qCosSDK.flushCdnPathCache(config);

secretIdsecretKey:在 COS控制台中,找到左侧的密钥管理,点进去,按照提示添加子账号,并设置秘钥。同时要给子账号赋予 COS相关的权限,还有CDN刷新的权限。不会配置的可以参考 官方示例

bucketregion: 在腾讯云的对象存储中,新建或找到你的 bucket,然后找到 默认域名 信息,会看到一个类似这样的域名: fun-12313.cos.ap-shanghai.myqcloud.com ,第一个点前面的 fun-12313 就是 bucket 名称,第二个点和第三个点之间的 ap-shanghai,就是你的 COS 所在地域,填写到 region 中。

distPathtargetPathdistPath是你的源文件的文件夹,填入是不需要带/targetPath是bucket的目标文件夹,如果为根目录,传空字符串即可,同样不需要用带/

cdnUrl: 是你的对象存储绑定的CDN域名,没有启用CDN,将enableCdn设置为false后可不设置

License

MIT