-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support compressed cmap files #109
Comments
Minor correction: this could be done on the client using the Compression Streams API (which is unfortunately currently not supported by FireFox and Safari). |
Now it's only Firefox that doesn't support the Compression Steams API. But an alternative approach might be to force the cmap-js loads a data source with a Mithril.js request API: cmap-js/src/model/DataSourceModel.js Lines 72 to 74 in 3521287
|
Probably my lack of JS experience, but it seems difficult to use the (asynchronous) Compression Streams API within a DataSourceModel method. What doesn't work (in src/DataSourceModel.js): setting xhr.responseType constructor(...) {
...
this.config = config || (url.endsWith(".gz")) ? function(xhr) { xhr.responseType = "blob"; } : "";
...
}
...
extract(xhr, options) {
if (xhr.responseType == 'blob') {
const ds = new DecompressionStream('gzip')
const response = new Response(xhr.response.stream().pipeThrough(ds));
// does not work; await cannot be used within extract()
xhr.responseText = await response.text();
}
return this.deserialize(xhr.responseText);
} (side node: I've only found |
Instead of setting the request header |
Deferring this for now in favor of an expedient solution where the http server is configured to set
|
It would be convenient if cmap-js could read .gz files without the user having to decompress them. Could possibly be implemented with nodejs zlib.
The text was updated successfully, but these errors were encountered: