@iro/tiny
v1.0.0
Published
# 编译 ```bash wasm-pack build ```
Downloads
2
Readme
PNGQUANT
编译
wasm-pack build
测试
# build 后进入 pkg 目录
pnpm link --global
# 进入前端项目
pnpm link --global pngquant
前端项目引入
import * as pngquant from 'pngquant'
const reader = new FileReader()
const file = // 带压缩图片文件
reader.readAsArrayBuffer(file)
reader.onload = () => {
const f = new Blob([pngquant.deflate(new Uint8Array(reader.result as ArrayBuffer))], {type: 'image/png'})
console.log(URL.createObjectURL(f))
}