1.安装依赖
npm i image-tools --save
2.引入
import { pathToBase64, base64ToPath } from 'image-tools'
3.调用方法
pathToBase64
pathToBase64(path) .then(base64 => { console.log(base64) }) .catch(error => { console.error(error) })
base64ToPath
base64ToPath(base64) .then(path => { console.log(path) }) .catch(error => { console.error(error) })