Has anyone decompressed Brotli .wasm.br files on the client? I'm doing that for load speed, but I'm struggling to find any resource on how to append the files to WebAssembly so that it uses them once they are decompressed.
Jakub Kostka
10/12/2024, 12:15 PM
I've tried loading the .wasm.br from my server, decompressing it, saving it as blobs, and then redirecting to it in composeApp.js. This doesn't seem to work as I'm getting an error "wasm validation error: at offset 4: failed to match magic number" even though my blob is at: blob:domain.xyz/randombloblhash which downloads the "magicnumber.wasm".
b
bashor
10/13/2024, 2:26 PM
You shouldn’t compress files manually, you only need a server configured using compression for static contents when a requester (browser) supports compression.
j
Jakub Kostka
10/13/2024, 7:13 PM
Got it, at least I know how it works now 😄. I'm completely new to this, as I'm originally an Android Developer, thanks for your help!
👍 1
Jakub Kostka
10/14/2024, 10:55 AM
For anyone looking for how to implement Brotli compression, since I struggled with it myself: I've solved it by decompressing the .wasm files to .br files within Github Action, which uploads it to my FTP. Then, instead of relying purely on Brotli compression on the server side, I've remapped any request made from .wasm.br to .br (inside .htaccess configuration). This way I have total control of the compression logic and everything works just fine.
b
bashor
10/14/2024, 1:25 PM
🤔 why do you need to deal with compression-decompression things?
bashor
10/14/2024, 1:25 PM
do you decompress files on client side?
j
Jakub Kostka
10/14/2024, 1:39 PM
No, the browser does, if it's supported. And I don't need to bother with it if I didn't want to, as you mentioned before, I just didn't have many options on how to configure the server, so I didn't want to rely on it 😅