Skip to content
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

Add docs on working with this crate in WebAssembly #176

Open
rylev opened this issue Jun 15, 2020 · 5 comments
Open

Add docs on working with this crate in WebAssembly #176

rylev opened this issue Jun 15, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@rylev
Copy link
Contributor

rylev commented Jun 15, 2020

It is possible to use this crate in WebAssembly though one needs to turn off the default features since they link to some C libraries. We should document this.

@rylev rylev added the enhancement New feature or request label Jun 15, 2020
@rambip
Copy link

rambip commented Nov 20, 2021

It's exactly what I'm trying to do !

I'm creating a web app to compress images to jpeg and I want to bundle them in a zip folder to be able to download them.

How could I do it ?

@rambip
Copy link

rambip commented Nov 20, 2021

I just found someone who tried to do something similar: https://github.com/Janlaywss/rust-zip-wasm/blob/main/src/lib.rs

@zamazan4ik
Copy link
Contributor

@rambip I hope you already tried to build zip library to WASM. Could you share please the instruction on how to do it? I have no experience with a compilation to WASM target and any help is really appreciated.

@Tamschi
Copy link

Tamschi commented Jan 22, 2022

@rambip I hope you already tried to build zip library to WASM. Could you share please the instruction on how to do it? I have no experience with a compilation to WASM target and any help is really appreciated.

For Rust projects targeting Wasm, this library can be used as normal. You can run

cargo check --target wasm32-unknown-unknown --no-default-features

to make sure it's compatible with that target. Testing in that environment is a bit more involved, but only required if you really have platform-specific cfgs where you'd like to actually run that code.

If you'd like to publish this library as stand-alone npm package (for use from JS), that's more involved and would require wrapping it appropriately. The wasm-bindgen + wasm-pack combination available at https://rustwasm.github.io/ should do the trick.

@rambip
Copy link

rambip commented Jan 23, 2022

Here is the project I compiled zip to wasm:
https://github.com/rambip/web-compress

To compile it you just need trunk

cosmicexplorer referenced this issue in cosmicexplorer/zip May 24, 2024
Implement `PartialEq`, `Eq`, `PartialOrd`, `Ord`, `Hash` and `Display` for `DateTime`
@Pr0methean Pr0methean transferred this issue from zip-rs/zip-old Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants