I was searching the internet for hours on end hoping to find any kind of built-in functionality to support byte-range requests (https://www.keycdn.com/support/byte-range-requests) within nestjs. I am coming from the .NET world where we have got something like this:
[Route("/streams/{id}")]
public IActionResult Clip(string Id) {
... more code ...
return File(myDataStream, "video/mp4", enableRangeProcessing: true);
}
Is there any analogous, similiar or comparable functionality within nestjs which I had then simply overlooked or do I really have to develop this rather cumbersome yet pretty common use-case on my own?
Kind regards Samuel
NestJS supports the standard Range request:
In this case, we're passing on the byte range (e.g. bytes=204993022- or similar, etc) to the s3 getObject request, which also supports range requests. But you can return a byte range from a node readStream request as well:
https://stackoverflow.com/a/70628753/228369