WebAssembly integration?

Is it possible to run rclone in this environment?

Wow, looks interesting! It looks like it might. Give it a go!

Note that we do compile rclone to webassembly also for another way of running rclone in the browser. It isn't well tested though.

Ok, you are talking about this web interface spawned from running rclone --rc-web-gui ?
But this is different, this would teoretically allow to run rclone without acces to binaries, like in not jailbroken ios...
If you look at issues there are interesting suggestions, like adding docker...

btw one issue says it is possible but in the future

It looks interesting but it needs someone to play with it I think!

where can i find this rclone wasm compiled?

We don't actually save the wasm binary, but we do build it.

If you want to build it yourself, do

GOOS=js GOARCH=wasm go build

It probably needs a bit more work to make it into something usable, but the idea is that you'd use the RC interface like librclone does to drive rclone.

1 Like

Hi Nick,

May I ask if there is a reason that you don't save the wasm binary in releases?

There hasn't been a need for it yet. Do you have a need for it? If so I'll save it.

I guess ideally I'd serve the latest version from somewhere for everyone to use.

Yes! I am experimenting with running rclone wasm on serverless, specifically Deno Deploy. After some patches (no document in worker, not working with latest go's wasm_exec.js), it works, so I think I would like to be able to experiment more. Here is what I have so far: Deploy Playground.

It would be nice to have the wasm version hosted on Github so that we can import it to use. However, considering that different users would need to configure the wasm file based on their need, so a catch-all build may not be useful.

With that said, you already have the Github Actions to build, so may as well include the WASM target :slight_smile:

Are these patches you could give in a PR?

Nice!

What configuration would users do do you think?

:slight_smile:

It would be nice to have a simple example of how to use the wasm build from javascript.

I would also like to have a version of the rclone gui which used the wasm backend - I tried to make this but my javascript foo was too weak!

Let me try to play around with it more to see if I can get a working task done with it. I'll submit PR to adjust.

Ideally, all the backends are included, but that results in a 76MB wasm file, which may not be ideal for the browser/serverless to compile. Some users may opt-in to only a couple of backends. But I honestly don't know how rclone can support such custom build process.

So I wrote this little library to abstract the common WASM steps into a class: GitHub - sntran/denolcr: Rclone running in Deno.
It's not JS, but I think I can build it to vanilla JS and have it run in the browser. It uses a stripped down wasm build though, as there is file size limit on the package hosting. That's why having the full wasm build hosted by rclone is more official and easier to work with.

I took a quick look at the React library for rclone gui, and I'm not sure how it would work with wasm. From what I understand, it's a client to talk to a rclone rc server running locally. Are you thinking of having the rc server in wasm and the client talking to it directly?

Great

It can't right now... There is always gzip!

The React library uses the same RC interface that the wasm library provides so it should be possible to join A onto B somehow so the react client uses the wasm library all in browser without needing a server somewhere else. This won't work for all backends, but it should do for the http based ones (which is most of them).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.