node.js的压缩和解压缩类库 compressing
支持格式: tar、gzip、tgz、zip
以zip为例,tar,tgz和gzip与zip相同。
压缩单个文件:
const compressing = require('compressing');
compressing.zip.compressFile('uploads/test.txt', 'uploads/test.zip').then(() => {}).catch(() => {});
压缩文件夹:
const compressing = require('compressing');
compressing.zip.compressDir('./uploads/test', 'test3.zip').then(()=>{}).catch(()=>{});
解压缩文件:
const compressing = require('compressing');
compressing.zip.uncompress('./uploads/test3.zip', './uploads/test3').then(() => {}).catch(() => {});