-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the problem
We can return a ReadableStream
from an endpoint in +server.ts, but trying to do the same from a form action in +page.server.ts makes Sveltekit complain that the data returned is not serializable.
I might be missing a reason why this isn't a good idea, but it would be convenient for me. In my case I allow the user to upload many files, some of which might be quite large. I would like to push status messages back to the user as the files are written on the server.
Describe the proposed solution
Allow returning ReadableStream
from form actions.
Alternatives considered
I could just use an API route, but then to handle the streamed response I need to use browser-side fetch
to submit, which means users without JS can't upload files (I think?).
In an ideal world, users without JS can still upload files, they just can't see any progress updates.
Importance
nice to have
Additional Information
No response