Last active
July 5, 2016 21:21
-
-
Save otbe/7b585ab92ca02f0bc504e6db495e990e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Get('/download/:id') | |
| async downloadFile(@Param('id') id: string): Promise<FileResult> { | |
| await queryDbForFileOrSo(); | |
| // content type will be inferred or explicit specified | |
| return new FileResult(stream | buffer | string [, 'application/pdf' ]); | |
| // or | |
| return new StreamResult(stream); | |
| // or | |
| return new BufferedResult(buffer); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment