压缩下载完成

This commit is contained in:
2019-12-17 20:55:50 +08:00
parent d43017eff2
commit 1be20ea269
10 changed files with 2742 additions and 15 deletions

18
bin/webg.js Normal file
View File

@@ -0,0 +1,18 @@
const convert = require('webp-batch-convert');
let webg = async (dir) => {
const cwebpOpts = {
quiet: true, // 不输出详情
q: 5 // 质量
};
// 清空输出目录
// convert.utils.delDir(__dirname + '/webp');
convert.utils.delDir(dir, /\.webp$/);
res = convert.cwebp(dir,dir, cwebpOpts);
// console.log('total: ', res);
convert.utils.delDir(dir, /\.jpg$/);
convert.utils.delDir(dir, /\.png$/);
return res;
}
module.exports = webg