Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Download files] Download files from an AWS S3 bucket. #421

Open
LoicPoullain opened this issue May 1, 2019 · 0 comments

Comments

@LoicPoullain
Copy link
Member

commented May 1, 2019

Issue

We currently have a solution to download a file from the file system (createHttpResponseFile). But we do not have a way to download in streaming a file from an AWS S3 bucket.

Possible solution

Create a package @foal/aws and a createHttpResponseFileFromS3 function.

import { createHttpResponseFileFromS3 } from '@foal/aws';
import { Context, Get } from '@foal/core';

class MyController {

  @Get('/my-pdf')
  getMyPdf(ctx: Context) {

    return createHttpResponseFileFromS3({
      bucket: 'name_of_the_bucket',
      key: 'name_of_the_file',
      // Tell the browser to download the pdf and not to display it.
      forceDownload: true
      // Default name used by the browser when saving the file to the client disk.
      filename: 'my_pdf.pdf',
    });

  }

}
@LoicPoullain LoicPoullain added this to Backlog in Issue tracking & Roadmap via automation May 1, 2019
@LoicPoullain LoicPoullain moved this from Backlog to To Do in Issue tracking & Roadmap Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
1 participant
You can’t perform that action at this time.