1// Sharp and FS module needed.
2;(async function(){
3 let imgBuffer = await sharp("./myimage.jpg").toBuffer()
4 let thumbnail = await sharp(imgBuffer).resize(100, 100).toBuffer()
5 let image = await sharp(imgBuffer).resize(1600, 900).toBuffer()
6 fs.writeFile("./thumbnail.jpg", thumbnail, err => {
7 if(err) console.log(err)
8 })
9 fs.writeFile("./image.jpg", thumbnail, err => {
10 if(err) console.log(err)
11 })
12})