dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.08k stars 1.56k forks source link

Add Brotli support #53906

Open Reprevise opened 10 months ago

Reprevise commented 10 months ago

The Dart team should consider adding the Brotli compression format from Google to the language. There are a number of implementations in different languages in the official repository.

While there are a couple of community packages that deal with Brotli, the one implemented in pure Dart has some unresolved issues and es_compression uses FFI. A pure Dart implementation would be ideal, in addition to official support from the Dart team.

kevmoo commented 10 months ago

CC @brianquinlan

lrhn commented 10 months ago

Seems rather complicated, and not necessarily well suited to be implemented in pure Dart. Using an existing native implementation can be both more efficient and more consistent. And it's not something that needs to be in the platform libraries. Definitely not in dart:io, possibly dart:convert, but a separate package is a much better fit. We don't have any compression algorithms on the platform libraries today.

Reprevise commented 10 months ago

I'd like to see HttpClient support Brotli as well (in addition to gzip), so if it were to be added to a package, would that still be possible?

sigurdm commented 8 months ago

We don't have any compression algorithms on the platform libraries today.

We do support gzip: https://api.dart.dev/stable/3.2.4/dart-io/gzip-constant.html And (as @Reprevise mentions) HttpClient supports Gzip-encoded responses by default.

Would be cool to support brotli here.