Sunday 30 December 2018

Compress or gzip an image for response

I'm writing an endpoint that fetches images off the file system and would like to compress the file but having trouble on the browser side.I'm using Node.js zlib module like thisresponse = fs.createReadStream(filePath).pipe(zlib.createDeflateRaw())this is deflating the file size correctly but on the client side the image element isn't rendering this response . Is this something that's even possible or am I doing it wrong? Thanks

Submitted December 30, 2018 at 05:48PM by crobinson42

No comments:

Post a Comment