-
Notifications
You must be signed in to change notification settings - Fork 118
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
Explain why we're not using ZIP #45
Comments
should make sure that the fact that .zip has duplication of headers that can cause mismatch of local vs central headers is mentioned |
how many of these arguments also stand against lzo or lz4 or (best) zstd? i'd also be interested in seeing how much of the raging popular https://github.com/opencontainers/image-spec would make sense to use, vs how much doesn't match up? |
@rektide I believe lzo, lz4, and zstd are better compression algorithms, and none of the arguments are about any quality issues in zip's compression, so ... all of them? I haven't looked through the opencontainers spec and will do so. Thanks for the pointer. |
Now that I've skimmed https://github.com/opencontainers/image-spec, it seems mostly-inapplicable. https://github.com/opencontainers/image-spec/blob/master/layer.md doesn't appear to support random access because it's a tar file. I'm having trouble finding the primary key of items in the image, but it seems like it's a path, contrary to https://tools.ietf.org/html/draft-yasskin-webpackage-use-cases-00#section-3.1.1. |
lz4 preferred for speed, zstd preferred for ratio. I am working on a similar packaging format and have a working tool, see I am very interested in cross adoption, @jyasskin 😃 |
While i have been playing with web bundles for a bit i can't say that i grew particularly fund of cbor and the way you are encoding things. you haven't made random access any easy, modifying a web bundle as a way to add/remove and even concat files together haven't been made any easy. Serving a bit more dynamic generated web bundles on the fly isn't any good at all. Encoding a web bundle literally requires you to allocate the web bundle in one go with lots of ram being used at once as you have to read the content out of all the file in order to generate some CBOR. it isn't any file streaming friendly at all. And it also requires a cbor dependency as opposite to just having as simple as built in json or even plain DataView to read/write data in a own format. i wish it where just some central directory like the zip files have in the end but in the beginning instead... so that i could simply just write the structure of everything and concatinate everything with my files afterwards. I think it was a misstake to encode the respons payload as an array of it would be a heck of a lot easier if i could just generate some small cbor directory, write how big it is, then write the cbor directory and then afterwards pipe all my files to the end of the stream. kind of like and this don't even supported any compressed payload either... i honestly think i want to stick to regular separate http requests with good caching and do more of code splitting and lazy loading when needed and writing more optimized code instead. and caching things on the fly as needed. |
fyi if the central cbor dir would have just known the size of a payload instead of the offset then it would be much easier to just simply concat multiple entries together and you could even do some kind of jobs more parallels if you eg would want to compress multiple files in parallel. and you wouldn't have to update the offset index or even calculate how large a cbor payload length is. which is necessary to calculate the offset cuz a byte array can be of different length. a major tag can be anything from 1-3 bytes depending on the size. so you need to some smart as logic something better could be more like: var cborSize = new Uint8Array(8)
var [ file1, file2 ] = input.files
var meta1 = {
url: origin + file1.name,
size: file1.size,
headers: { ':status': 200, 'content-type': file1.type, 'content-length': file1.size },
extraFields: { ... }
}
var meta2 = {
url: origin + file2.name,
size: file2.size,
headers: { ':status': 200, 'content-type': file2.type, 'content-length': file2.size },
extraFields: { ... }
}
var cbor = encode([ meta1, meta2 ])
const dv = new DataView(cborSize)
const dv.setBigUint64(0, cbor.byteLength)
const webBundle = new Blob([ cborSize, cbor, file1, file2 ]) ☝️ here in this example you
the file payload should have been kept apart from the hole cbor response payload... it would have made the parsing of the central cbor structure more easier and allow for more random access more easier and then making random byte range requests to the things you need also an option to have the central directory in either the end or in the beginning would be neat if you want to dynamically generate a web bundle where you don't know the number of request as of yet. |
I'm only wondering if you took any consideration into choosing zip's extra custom fields? it have the option to add in extra fields such as response headers. request url and more that's needed |
We have some hints in https://w3ctag.github.io/packaging-on-the-web/#intro, but it's not complete, and it needs to appear in the local explainer, not something remote.
Other considerations against zip:
We should probably also list reasons in favor of re-using zip so that proponents know we've considered their arguments:
The text was updated successfully, but these errors were encountered: