Skip to content

Documentation/Examples for streaming requests and responses #5344

@dodiameer

Description

@dodiameer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions