是否有可以使用NodeJS将缓冲区数据压缩到较小尺寸的方法?
我正在研究Lambda功能,该功能从Google驱动器中获取图像并将其上传到S3存储桶。
我与之合作的数据格式是一个缓冲区,当我将其上传到S3桶时,大小为2.8MB。但是,我需要将其压缩为2MB。我似乎找不到可以处理该服务器端的合适库。
有建议吗?
I'm working on a Lambda function which fetches images from a Google drive and uploads it to S3 bucket.
The format of the data I'm working with is a Buffer and when I upload it to S3 bucket the size is 2.8mb. However I need to compress it to be under 2mb. I can't seem to find a suitable library which can handle this server side.
Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了压缩图像并存储它,您可以使用
jimp
,它是一个图像处理库,并提供所需的所有设施。作为参考,您可以转到此 documentation
For compressing images and storing it, you may use
Jimp
which is an image processing library and provides all the facilities you're looking for.For reference, you may go to this documentation