opendal icon indicating copy to clipboard operation
opendal copied to clipboard

WASM Support

Open Xuanwo opened this issue 3 years ago • 4 comments

We need to wait for some key deps to support wasm:

  • https://github.com/tokio-rs/tokio/pull/4716

Xuanwo avatar Apr 24 '22 09:04 Xuanwo

https://github.com/tokio-rs/tokio/pull/4716 has been closed. We can try to find out how blocks are in front of us.

Xuanwo avatar Jul 28 '22 16:07 Xuanwo

We can allow accessing s3/gcs from browser

Xuanwo avatar Jan 19 '23 08:01 Xuanwo

Some blocks:

  • ureq: we need to find a replace for ureq related API.
    • maybe we need to call: https://docs.rs/web-sys/latest/web_sys/struct.Request.html
  • web_sys::RequestInit is not send
note: future is not `Send` as this value is used across an await
    --> /home/xuanwo/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.11.14/src/wasm/client.rs:225:57
     |
185  |       let mut init = web_sys::RequestInit::new();
     |           -------- has type `web_sys::features::gen_RequestInit::RequestInit` which is not `Send`
...
225  |       let js_resp = super::promise::<web_sys::Response>(p)
     |  _________________________________________________________^
226  | |         .await
     | |______________^ await occurs here, with `mut init` maybe used later
...
252  |   }
     |   - `mut init` is later dropped here
     = note: required for the cast from `impl futures::Future<Output = std::result::Result<rps::RpCompleteMultipart, error::Error>>` to the object type `dyn futures::Future<Output = std::result::Result<rps::RpCompleteMultipart, error::Error>> + std::marker::Send`

Xuanwo avatar Jan 20 '23 00:01 Xuanwo

We can use https://docs.rs/tokio/latest/tokio/task/struct.LocalSet.html for JsFuture

Xuanwo avatar Jan 21 '23 04:01 Xuanwo