Skip to content

File downloads (streaming responses) #2230

Description

@bajtos

To allow LB4 applications to implement file downloads, we need to make improvements in several areas:

  1. A route (a controller method) must be able to specify not only the response body, but also additional response headers (e.g. Content-Disposition: attachment; filename="filename.jpg"). This is already covered by the issue Configurable response types/formats #436.
  2. It should be possible for routes to provide the response body as a ReadableStream and Buffer too.
  3. Nice to have: a helper function similar to res.download provided by Express that will accept a file name and create an LB4 response object with all necessary fields correctly filled (content type, content disposition, body stream, etc.)
  4. Documentation: explain how a route can specify the response headers and provide body as a readable stream.

Related issues:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions