# cdnplz

> A tool for CDN

Latest version **1.0.0** (published 2017-04-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install cdnplz
pnpm add cdnplz
yarn add cdnplz
bun add cdnplz
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-04-07 |
| First published | 2017-04-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | zhouweicsu |
| Maintainers | zhouweicsu |
| Keywords | cdn |

## Links

- npm: https://www.npmjs.com/package/cdnplz
- Repository: https://github.com/zhouweicsu/cdnplz
- Issues: https://github.com/zhouweicsu/cdnplz/issues
- npm.io page: https://npm.io/package/cdnplz

## Dependencies (2)

- [glob](https://npm.io/package/glob.md) ^7.0.5
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1

## Recent versions

- 1.0.0 (latest) — 2017-04-07

## README

# cdnplz
A tool for uploading file to cdn.

# How to use?

```javascript
const cdnplz = require('cdnplz');

try{
    new cdnplz({
        tpl_suffix: 'jade',   //the suffix of template file
        tpl_path: 'app/view', //the root path of template file
        static_path: '.',  //the path of the static file
        output_path: 'output/view/', //the output path of template file
        file_encoding: 'utf8',
        cdn_provider: 'yourCdnProvider',//the cdn provider provided by user
        cdn_options: {//the options of the cdn provider
            https: true
        }
    }).start();
}catch(e){
    console.log(e);
}
```

# you should provide a cdn provider

```javascript
const cdnProvider = require('yourCdnProvider');

module.exports = {
    upload: function(filePath, options){
        return cdnProvider.upload(filePath, options);
    }
}
```
Cdn provider should return a object which has a `upload` method, and this `upload` method takes `filePath` and `options` as parameters, returns a Promise. The data resolved by the Promise must be a Object like this:
```
{ 
  './static/img/logo.png': 'https://p1.ssl.qhimg.com/t010a4bf91e826708df.png' ,
  './static/js/main.js': 'https://s0.ssl.qhimg.com/static/c870687eb082c330.js'
} 
```

# qiniu cdn Provider

https://github.com/webzhao/cdnplz-qiniu

---
_Source: https://npm.io/package/cdnplz · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
