The frontend portion is nothing more than the official tus-js-client with the
endpoint set to /files
.
The endpoint does not necessarily need to be on the same domain as the client files. For the sake of convenience, this demo embeds the index.html and client.js into the worker.js bundle. But those items could be hosted via other means just as easily, although you will of course need appropriate CORS headers added to the responses.
This example also contains functionality which allows you to download files after uploading and could potentially be abused by malicious users.
This example must be published to Cloudflare's Worker service, so you'll need a Cloudflare account as well as a publicly available S3-compatible cloud storage service.
- From the tussle project root run
yarn install
andyarn build
to build the individual tussle packages. - Copy
wrangler-example.toml
towrangler.toml
. - Edit
wrangler.toml
and edit ther2_buckets
bindings to point to an R2 bucket which you've created in the Cloudflare dashboard. - Run
yarn install
to install dependencies. - Run
yarn build
to build the worker script bundle. - Run
yarn deploy
to deploy the worker (and embedded frontend asset) bundle to Cloudflare.
If all is successful, wrangler should notify you of the resulting URL which the worker can be accessed. Have fun!