Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

uploadcdn

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uploadcdn

upload file to cdn

Source
npmnpm
Version
1.0.6
Version published
Weekly downloads
12
140%
Maintainers
1
Weekly downloads
 
Created
Source

内部将文件批量上传至cdn

使用

安装

npm i uploadcdn --save-dev

webpack导入


const uploadcdn = require('uploadcdn');

const getTimePrefix = require('uploadcdn').getTimePrefix;
// 获取CDN前缀
const publicPath = getTimePrefix();
...
publicPath: 'https://cdn.com/' + publicPath,
plugins: [
  // 注意需要上传form的格式是file
  new uploadcdn.Upload2cdnPlugin({cdnUrl: 'https://qiniu.com'})
]

单独引入


const uploadCDN = require('uploadcdn').uploadCDN;
// cdnUrl,cdn的上传链接,相对路径的filelist文件列表,dirname文件目录
uploadCDN(cdnUrl, filelist, dirname)

Keywords

cdn

FAQs

Package last updated on 31 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts