Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
In node.js server, how can we add the errors(if occurs in between transfer) to the response which contains stream of file data like image/video etc

I am using the latest TS.ED framework which uses Typescript and is based on Express/node.js itself. Below, I am using the FFmpeg library to generate snapshots and then creating a zip folder of all those thumbnails and sending as a response to the client(Angular) or Postman to receive the zip file as a stream).

    @Get('/thumbnails')
    @Returns(400, BadRequest)
    @(Returns(500).Description(`Internal Server Error`))
    async generateThumbnails(
        @QueryParams('video') videoURL: string
        @Res() resp: Res
    ): Promise<fs.ReadStream> {
        resp.setHeader('Content-Disposition', `attachment; filename=thumbnails.zip`);
        resp.setHeader('Content-Type', 'application/zip');
        return await this.myffmpegService.generateThumbnailsFromVideo(videoURL);
    }

My question is how we will be able to find out that the stream transferred is not complete meaning suppose if it is a video stream(of 10 seconds) that might fail at 8th second, then the client will get up to the 8th second of the video data stream only, I just want to figure out that how can we add(somehow) the error that "this is not complete data but with a specific error" (occurred in between)?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!