Skip to content

Help with file redirect responses #106

Description

@jyecusch

When responding to API requests with a file a convenience method would be nice that sets the appropriate response headers for a redirect and returns the pre-signed read URL.

Dev experience should be something like this:

import { api, bucket } from "@nitric/sdk";

const files = bucket('files').for('reading');
const fileApi = api('file-api');

fileApi.get("/files/:filename", async (ctx) => {
  const { filename } = ctx.req.params;
  const file = files.file(filename)
  ctx.res.file(file);
});

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