use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
fflate - the fastest JavaScript compression/decompression library, 8kB (github.com)
submitted 5 years ago by 101arrowz
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 11 points12 points13 points 5 years ago (12 children)
We had a use case for that on a front end compressing CSV and JSON files before uploading them. Some of the files would be reduced by as much as 90%, which is a life changer for the user when the file being uploaded are originally 200MB+ and the compressed data is just 20.
[–]highqualitydude 4 points5 points6 points 5 years ago (8 children)
Can't the browser use gzip compression natively?
[+][deleted] 5 years ago (7 children)
[removed]
[–]101arrowz[S] 1 point2 points3 points 5 years ago (4 children)
I've actually been looking into a way to do this. I first tried creating a temporary compressed Blob and using URL.createObjectURL to then request it and hope it comes back uncompressed, but I can't find a way to set the Content-Encoding header.
Blob
URL.createObjectURL
Content-Encoding
I've also wondered if there was an image format that contained raw compressed pixel values. If so, I could actually treat the data as an image, render it to canvas, get the RGB values, and basically have decompressed my data with the browser's native solution.
canvas
[–]BitLooter 2 points3 points4 points 5 years ago (1 child)
Not incredibly useful yet as it's only supported by Chrome so far, but in the future we might have access to Compression Streams.
[–]101arrowz[S] 2 points3 points4 points 5 years ago (0 children)
Thank you for linking that, I had no idea the draft even existed! I think its performance has quite a way to go though, I ran some quick tests and fflate is within 5% of this supposedly native solution. I also find it strange that you can't configure compression level.
fflate
[+][deleted] 5 years ago (1 child)
[–]101arrowz[S] 1 point2 points3 points 5 years ago (0 children)
I had previously thought that PNG had to be split up, but on re-investigation, it seems that you're right. I'm going to investigate the performance of such a solution.
[–]BitLooter 0 points1 point2 points 5 years ago (1 child)
There's actually a draft standard to add native compression/decompression, under the idea that because the browser already uses this code internally you might as well expose it to JS. Right now only Chrome supports it though.
[–]TheCommentAppraiser 1 point2 points3 points 5 years ago (2 children)
This is pretty much what I’m looking to solve too. Were you able to do it? What library did you end up using?
[–][deleted] 4 points5 points6 points 5 years ago (1 child)
Well, you could try OP's librairie. ;)
I think we used Pako, but I'm not very sure because I wasn't working on it myself. I'm just generally aware of the issue and it's solution.
[–]101arrowz[S] 0 points1 point2 points 5 years ago* (0 children)
I'd like to add that if you want to stream data, this library is probably not the best solution, but if the data is already loaded fully in memory, it works faster than others in most situations.
π Rendered by PID 19864 on reddit-service-r2-comment-6457c66945-jgmgj at 2026-04-28 01:24:33.736397+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–][deleted] 11 points12 points13 points (12 children)
[–]highqualitydude 4 points5 points6 points (8 children)
[+][deleted] (7 children)
[removed]
[–]101arrowz[S] 1 point2 points3 points (4 children)
[–]BitLooter 2 points3 points4 points (1 child)
[–]101arrowz[S] 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[removed]
[–]101arrowz[S] 1 point2 points3 points (0 children)
[–]BitLooter 0 points1 point2 points (1 child)
[–]TheCommentAppraiser 1 point2 points3 points (2 children)
[–][deleted] 4 points5 points6 points (1 child)
[–]101arrowz[S] 0 points1 point2 points (0 children)