Has anyone decompressed Brotli .<wasm.br> files on...
# webassembly
j
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.
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
You shouldn’t compress files manually, you only need a server configured using compression for static contents when a requester (browser) supports compression.
j
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
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
🤔 why do you need to deal with compression-decompression things?
do you decompress files on client side?
j
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 😅