sveltejs / sveltejs/kit

Documentation/Examples for streaming requests and responses

Open
#5,344 25 comments 46 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

As of #5291 SvelteKit now supports using ReadableStream to read the request body in endpoints and supports returning it as a response body, however there are currently no examples in the docs on how to do common things, for example reading files submitted from a multipart/form-data as a stream and write them to disk, reading files from disk and returning them as a stream, etc.

Describe the proposed solution

Adding examples for common use-cases of streaming in the docs

Alternatives considered

No response

Importance

nice to have

Additional Information

I would help with this myself, but I honestly couldn't figure it out, and I wouldn't trust the code I write to be up to the standard of the docs. I specifically wanted to handle super-large (over 1gb) file uploads that would be in a multipart/form-data request with other fields but couldn't figure it out.

Also feel like I should mention this: in #3419, Rich mentions having utility functions for handling multipart/octet streams, so if the maintainers are planning on adding them then it would make sense to not add documentation until they are added, as they would simplify any code that could be written without them.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing SvelteKit documentation for endpoint request and response bodies, then check how ReadableStream examples fit with the multipart utilities mentioned in #3419. Done means documenting common streaming request and response use cases, including large multipart uploads and reading files from disk, using examples that match the supported APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.