-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CompressStream #410
Comments
Is there a single gzip algorithm everyone can and is willing to converge on? |
As long as the compatibility (e.g. between Chromium and Firefox, or old versions and new versions of Chromium) is kept, I think it is better if CompressStream permits other gzip algorithms. |
I haven't researched gzip much, but would a single implementation ever have more than a single algorithm? If the algorithm can change, how do we ensure other participants in this ecosystem remain compatible? Where are the algorithms defined? |
Yes, zlib uses different algorithms depending on the compression level. Gzip is standardized and implementations extensively test against each other, so participants in this ecosystem will remain compatible. The algorithms are defined in RFC 1952 https://tools.ietf.org/html/rfc1952. |
Overall this looks good to us. A few relatively minor points:
|
There are cases where you might want to compress data but you don't have a stream. For instance in the Web NFC API people are usually dealing with small amounts of data (ArrayBuffers for instance) and it would be useful to be able to compress those in an easy manner instead of trying to turn things into a stream |
There is an example of some boilerplate code to compress an ArrayBuffer into a Uint8Array, I agree having that (probably as a static method on the class) would be convenient and prevent a lot of repetition. |
If there are more than just compression cases (e.g. I can imagine stuff like streamed crypto) where you want to throw in non-stream data, feels like that mechanism could/should be provided as a infrastructure API. (I agree the usecase is valid and makes sense.) |
I discussed this with @CanonMukai but we preferred to use a single constructor. At least in Blink, new symbols on the global object are moderately expensive, and I wanted to avoid adding them unnecessarily. My current thinking for polyfilling / user extensibility is to have a dictionary
I hadn't considered this. My one reservation is that using "br" for Brotli seems a little obscure. Filed as whatwg/compression#7.
Yes. One thing that needs more examination is that different algorithms will have different options. For example, gzip will eventually have a filename option. It's not immediately clear to me how to handle this. Filed as whatwg/compression#6.
The awkward thing about Brotli is that to support compression we need to add a 140KB dictionary to the binary. This is a difficult trade-off and I don't have good answer for it yet. Supporting decompression is nearly free, but does it make any sense to only support decompression? |
There is a small precedent here with |
(If we keep using that pattern we should try to abstract it into IDL though.) |
I've filed whatwg/compression#8 for this.
I filed issues against the streams standard to discuss these APIs: whatwg/streams#1018 and whatwg/streams#1019. If we implemented these, the boilerplate would reduce to const output = await ReadableStream.from(input).pipeThrough(new CompressionStream('gzip')).arrayBuffer(); Although there's no reason why we can't do both. |
A couple of updates to the metadata: Specification URL: https://ricea.github.io/compression/ (final location TBD) |
@ricea should I update the initial post's metadata to above? |
Yes, thank you. |
Hi, Looked at the security & privacy questionnaire. Thanks for listing CRIME. Otherwise for the time being looks OK to me. |
A little bit obscure but still well known, so it is always better to avoid defining another such registry. |
こんにちはTAG!
I'm requesting a TAG review of:
Further details:
We recommend the explainer to be in Markdown. On top of the usual information expected in the explainer, it is strongly recommended to add:
You should also know that...
This proposal is still in the early stages.
We'd prefer the TAG provide feedback as (please select one):
Please preview the issue and check that the links work before submitting. In particular, if anything links to a URL which requires authentication (e.g. Google document), please make sure anyone with the link can access the document.
¹ For background, see our explanation of how to write a good explainer.
The text was updated successfully, but these errors were encountered: