PhoenixBakery.Zstd (phoenix_bakery v0.1.0) View Source

[Zstandard][zstd] is algorithm that offers quite good compression ratio when compared with Gzip, but slightly worse than Brotli, but with much betted decompression speed. It is currently not supported by browsers, but is already IANA standard, so the rollout of the support should be pretty fast.

Requirements

To use PhoenixBakery.Zstd you need at least one of:

  • Add {:ezstd, "~> 1.0", runtime: false} to use NIF version of Zstd compressor. It requires C code compilation and git tool to be available to fetch the code of zstandard code.
  • Have zstd utility available in $PATH or configured via config :phoenix_bakery, :zstd, "<path-to-zstd-executable>/zstd"

If none of the above is true then compressor will raise.

Configuration

config :phoenix_bakery,
  zstd_opts: %{
    level: 10 # defaults to: `22` (ultra-max)
  }