All Projects → yingye → qcloud-upload

yingye / qcloud-upload

Licence: MIT license
基于 nodejs 腾讯云 cos 静态资源上传插件

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to qcloud-upload

gulp-upload-qcloud
腾讯云 cos 静态资源上传 gulp 插件
Stars: ✭ 18 (+28.57%)
Mutual labels:  cdn, cos
plugin-intellij
jsDelivr plugin for JetBrains IntelliJ based editors
Stars: ✭ 18 (+28.57%)
Mutual labels:  cdn
freecdn
A front-end CDN based on ServiceWorker
Stars: ✭ 850 (+5971.43%)
Mutual labels:  cdn
lambda-resize-image
An AWS Lambda Function to resize images automatically with API Gateway and S3 for imagemagick tasks. When an image is called on AWS Api Gateway, this package will resize it and send it to the S3.
Stars: ✭ 56 (+300%)
Mutual labels:  cdn
WebEssentials.AspNetCore.CdnTagHelpers
A CDN helper for ASP.NET Core
Stars: ✭ 44 (+214.29%)
Mutual labels:  cdn
terraform-aws-cloudfront-cdn
Terraform Module that implements a CloudFront Distribution (CDN) for a custom origin.
Stars: ✭ 89 (+535.71%)
Mutual labels:  cdn
vsc-markdown-image
Easy to insert a image to markdown
Stars: ✭ 140 (+900%)
Mutual labels:  cdn
node-version-assets
Version your static assets with MD5 hashes using node.js
Stars: ✭ 65 (+364.29%)
Mutual labels:  cdn
cos-ftp-server-V5
腾讯云对象存储(COS-V5)的FTP Server
Stars: ✭ 35 (+150%)
Mutual labels:  cos
cos-go-sdk-v5
Tencent cloud object storage service client 5.0 xml version __腾讯cos-go-sdk-v5__
Stars: ✭ 34 (+142.86%)
Mutual labels:  cos
laravel-assetcachebuster
Laravel 5 package that prefixes asset urls with a unique hash which will allow invalidation of asset files cached by the browser.
Stars: ✭ 33 (+135.71%)
Mutual labels:  cdn
flutter-p2p-engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 93 (+564.29%)
Mutual labels:  cdn
media-delivery
This collection of samples demonstrates best practices to achieve optimal video quality and performance on Intel GPUs for content delivery networks. Check out our demo, recommended command lines and quality and performance measuring tools.
Stars: ✭ 26 (+85.71%)
Mutual labels:  cdn
uploadcare-ios
UploadcareKit: iOS SDK for Uploadcare API
Stars: ✭ 24 (+71.43%)
Mutual labels:  cdn
simple-image-server
Host Your Own Image Server based on MongoDB, Azure Blob Storage or Google Drive
Stars: ✭ 29 (+107.14%)
Mutual labels:  cdn
go-cdn
No description or website provided.
Stars: ✭ 18 (+28.57%)
Mutual labels:  cdn
node-csgo-cdn
Retrieves the Steam CDN Image URLs for CS:GO Items
Stars: ✭ 51 (+264.29%)
Mutual labels:  cdn
cossync
腾讯云COS同步(批量上传)工具
Stars: ✭ 23 (+64.29%)
Mutual labels:  cos
cdnupload
Upload your site's static files to a directory or CDN, using content-based hashing
Stars: ✭ 41 (+192.86%)
Mutual labels:  cdn
image-upload-app
A simple image upload application using React and Node, which explores multiple ways to upload an image including using multer as a middleware, a CDN system and converting an image to a string and storing it.
Stars: ✭ 35 (+150%)
Mutual labels:  cdn

qcloud-upload

基于 nodejs 腾讯云上传插件,支持自定义文件前缀、覆盖及非覆盖上传方式

Install

npm install --save-dev qcloud-upload

Usage

Step 1. 创建文件 upload.js

const uploadQcloud = require('qcloud-upload');

const options = {
  AppId: 'STRING_VALUE',
  Region: 'STRING_VALUE',
  SecretId'STRING_VALUE',
  SecretKey'STRING_VALUE',
  Bucket: 'STRING_VALUE',
  Headers: {
    CacheControl: 'max-age=31536000'
  },
  prefix: 'test',
  src: './examples',
  overWrite: 1
};

uploadQcloud(options);

Step 2. 执行上传操作 node upload.js

API

uploadQcloud([options])

options

Type: Object

There are 8 options:
  • AppId(string): 注册或登录 腾讯云 获取您的AppId,可参考下方说明。
  • SecretId(string): 到 腾讯云控制台密钥管理 获取您的项目 SecretId 和 SecretKey。
  • SecretKey(string): 同 SecretId。
  • Bucket(string): 到 COS 对象存储控制台 创建存储桶,得到 Bucket(存储桶名称) 和 Region(地域名称)。
  • Region(string): Bucket 所在区域。枚举值请见:Bucket 地域信息
  • Headers(object): 设置头信息,具体 API 参考简单上传-参数说明
  • prefix(string): 自定义文件前缀,例如本地文件路径 img.png ,设置了 Prefix: 'demo',最终腾讯云路径为 demo/img.png,默认为空。
  • overWrite(string): 是否覆盖同名文件,默认 false。
  • src(string): 上传文件夹相 相对路径,以本项目 examples 文件夹为例,设置 src: './examples',上传腾讯云后文件路径为 https://static.demo.com/your-options.prefix/img.png。(v1.3.0以上版本支持)

以下 API 在 v1.3.0+ 版本中废弃:

  • dirPath(string): 上传文件夹的 绝对路径 ,以本项目 examples 文件夹为例,应设置 path.resolve(__dirname, './examples')
  • distDirName(string): 截取文件路径参考项,以本项目 examples 文件夹为例,不设置该项,上传腾讯云后文件路径为 https://static.demo.com/your-options.prefix/Users/yingye/Desktop/qcloud-upload/examples/img.png。若设置该项 distDirName: 'examples' 后,文件URL为 https://static.demo.com/your-options.prefix/examples/img.png,相当于对 dirPath 绝对路径做了截取操作。
! AppIdBucket 的说明:

腾讯云官方 api 修改,去掉 AppId 概念,Bucket 需要传入这样的格式 test-1250000000。本插件,兼容两种配置方式,示例如下:

// old api options
const options = {
  AppId: 'your AppId',
  Bucket: 'old Bucket',
  ...
};
// new api options
const options = {
  Bucket: 'AppId-Bucket',
  ...
};

TIPS

该插件基于 腾讯云 COS Nodejs SDK V5 构建,可参考腾讯云官方文档 Node.js SDK

如果项目中使用构建工具 gulp,建议使用 gulp-upload-qcloud

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].