On dinsdag 8 september 2020 11:57:16 CEST Christian Grün wrote:
This example demonstrates that compression-level="0" does do what
the api promises:
I can have a closer look into that. Could you possibly provide me with a little self-contained example that I can run out of the box?
Here is an example that creates a new archive that uses compression-level="0" and algorithm="stored" and still compresses that entry.
Note that the archive level option 'algorithm' is unfortumate because often it is only single entries such as 'mimetype' or images that should not be compressed. The algorithm should be 'stored' for every entry that has compression-level="0".
```xquery declare namespace file = "http://expath.org/ns/file"; declare namespace archive = "http://basex.org/modules/archive";
(: Create a zip file with one uncompressed file :) let $file := "test.epub" let $mimetype := "application/epub+zip" let $entries := ( <archive:entry compression-level='0'>{"mimetype"}</archive:entry> ) let $contents := ($mimetype) let $zip := archive:create($entries, $contents, map { "format": "zip", "algorithm": "stored" } ) return file:write-binary($file, $zip) ```
Best regards, Jos