1.0.0 • Published 3 years ago
dichotomy-compress v1.0.0
一个用于压缩图片到指定大小的插件,
****用法****
compress(file, targetSize).then(res) file:文件对象,可以传file或blob targetSize: 压缩的指定大小 res: 压缩后的blob
**示例**
compress(file, 1).then(res => { let a = document.createElement('a') a.download = 'a.jpg' a.href = URL.createObjectURL(new Blob(res)) a.style.display = 'none' document.body.appendChild(a) a.click() URL.revokeObjectURL(a.href) document.body.removeChild(a) })
1.0.0
3 years ago