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

@tus/server: split server into runtimes #461

Open
Murderlon opened this issue Jul 19, 2023 · 5 comments
Open

@tus/server: split server into runtimes #461

Murderlon opened this issue Jul 19, 2023 · 5 comments

Comments

@Murderlon
Copy link
Member

In order to make the tus server less tightly coupled to Node.js, we can create runtime adapters which are consumed in the request handlers. This would allow tus to be ran on the edge, such as with Cloudfare Workers.

Example is how Remix does this:
https://github.com/remix-run/remix/tree/main/packages/remix-cloudflare-workers

@Acconut
Copy link
Member

Acconut commented Jul 25, 2023

That might be a good abstraction to keep the main upload handling logic clean. In tus-js-client, we have similar HTTP adapters, but for the outgoing HTTP requests not the incoming ones. This way, we have one logic, but HTTP adapters for Node and the browser.

I don't have much experience with this edge computing, but I am wondering how well a tus server is fitted there. Do edge functions have streaming access to the request body? Or do they only receive a buffered version of the request once it has been fully transmitted?

@Murderlon
Copy link
Member Author

Do edge functions have streaming access to the request body? Or do they only receive a buffered version of the request once it has been fully transmitted?

AFAIK JS runtimes stay as close as possible to each other so I wouldn't expect this to be suddenly different.

@fenos
Copy link
Collaborator

fenos commented Jul 28, 2023

@Acconut @Murderlon implementation wise yes all edge runtimes are following the same standards and most runtimes do support request streaming.

Also, I would expect users using the client side chunkSize when using the edge implementation as usually edge function invocations has a time limit or resource limit

@Acconut
Copy link
Member

Acconut commented Aug 3, 2023

implementation wise yes all edge runtimes are following the same standards and most runtimes do support request streaming.

That's great to hear!

@CanRau
Copy link

CanRau commented Nov 1, 2023

I think this would be fantastic.

There's https://github.com/Klowner/tussle which basically does this and could serve as inspiration or maybe there's even an opportunity for collaboration.

Trying to integrate a tus server in a Rakkas API route which is basically HatTip on the server which already supports all/most (edge) runtimes

@Murderlon Murderlon changed the title @tus/server: split server into runtimes so tus can run on the edge @tus/server: split server into runtimes Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants