jimp爬取网络图片到本地
// https://www.npmjs.com/package/jimp
const Jimp = require('jimp')
Jimp.read(`https://readfree.me/${id}`)
.then(lenna => {
const url = path.join(__dirname, `../public/${id}`)
lenna
.resize(256, Jimp.AUTO) // resize
.quality(90) // set JPEG quality
.write(url) // save
})
.catch(err => {
data.thumbnail = 'default.jpg'
})
胖胖熊笔记,笔记已迁移