DEV Community

Discussion on: Streaming Video with Nestjs

micalevisk profile image
Micael Levi L. C. • Edited

cool! another way would be:

@Header('Content-type', 'video/mp4')
@Header('Content-Disposition', 'inline; filename="video.mp4"')
getFile(): StreamableFile {
  const file = createReadStream(join(process.cwd(), 'videos/video.mp4'));
  return new StreamableFile(file);
Enter fullscreen mode Exit fullscreen mode
xgeek116 profile image

@micalevisk How a frontend client like react will receive the StreamableFile(file) ? If it was a large PDF file for example ? is there a way to send it / receive it piece by piece ?

savi8sant8s profile image
Sávio Santos

Even better. very cool!!