Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

271
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda