Hacker News new | ask | show | jobs
by ochronus 2056 days ago
Nice! Pagespeed Insights is also happy with your site ;) I especially liked the new format stats, pretty impressive. Now if only I found a good node module for avif conversion...
1 comments

Thanks.

If you're okay with a non-node/js solution, use https://github.com/kornelski/cavif-rs - it does the job for me pretty well.

For node it looks surprisingly disappointing right now, the only real candidates being the packages @saschazar/wasm-avif (v1.0.0) and avif (v0.0.1-alpha2) — I'll probably never understand the ecosystem and community, the format is out for some time and fully supported in the most widely used browser, yet barely noticeable support in the JS world.

Thanks for the tips - I'm tied to node at the moment - wasm-avif has serious issues with thready safety an memleaks :( tried it.
Sharp lib is veeeerrryyy close to AVIF support: https://github.com/lovell/sharp/issues/2289 (you can compile a version to use for yourself, it's just not production stable yet).
If you're in control of the environment, you might want to consider the yak shaving road and build a node package with a C, C++ or Rust library then. ;-)