Skip to content

Instantly share code, notes, and snippets.

@otbe
Last active July 5, 2016 21:21
Show Gist options
  • Select an option

  • Save otbe/7b585ab92ca02f0bc504e6db495e990e to your computer and use it in GitHub Desktop.

Select an option

Save otbe/7b585ab92ca02f0bc504e6db495e990e to your computer and use it in GitHub Desktop.
@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