compress icon indicating copy to clipboard operation
compress copied to clipboard

[feat] Add zstd

Open uhop opened this issue 7 months ago • 1 comments

Describe the feature

New Content-Encoding is introduced: zstd. All browser vendors work on this feature and most support this feature already: https://caniuse.com/zstd

Why zstd? While it doesn't compress as efficiently as brotli, which we already have, it is significantly faster. It is faster and more efficient than gzip, which we have too.

zstd is added to node:zlib in v23.8.0, v22.15.0. Currently it is marked as "Experimental". We can test if zstd-related functions are available in Node and provide this functionality conditionally. In a short while, it'll be in all supported Node versions.

Relevant references:

  • https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Encoding
  • https://datatracker.ietf.org/doc/html/rfc8878
  • https://en.wikipedia.org/wiki/Zstd

Personally I already saw it in the wild. For example, it is implemented by CloudFlare servers.

Checklist

  • [x] I have searched through GitHub issues for similar issues.
  • [x] I have completely read through the README and documentation.

uhop avatar May 30 '25 06:05 uhop

Again, if it is considered worthwhile, I can code a PR for that like I did for br before.

uhop avatar May 30 '25 21:05 uhop