Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda