I tried to Decrease Image File Size When It's Download From Google Image URL. I tried imagemin npm package but it's only available in javascript. I need to available on the typescript.
My Image Download Code is:
const download = (url, path, callback) => {
request.head(url, (err, res, body) => {
request(url)
.pipe(fs.createWriteStream(path))
.on('close', callback)
})
}
download(myUrl, myPath, () => {
// console.log('Image download Done!')
})
Does anyone Suggest to me any Good npm package or any example for reducing the Image File Size?
You can try using the npm library called sharp
Heres the link