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

440
Visualizações
Argument of type 'Blob' is not assignable to parameter of type 'string | Blob'

Just got an error:

Argument of type 'Blob' is not assignable to parameter of type 'string | Blob'.
  Type 'import("buffer").Blob' is not assignable to type 'Blob'.
    The types returned by 'stream()' are incompatible between these types.
      Type '{}' is missing the following properties from type 'ReadableStream<any>': locked, cancel, getReader, pipeThrough, and 2 more.

And can't understand what's going on. Tried to restart vscode but didn't help. Blob is not assignable to param of type Blob. ?! So Blob returned by stream is not the same with usual Blob?

This is my code

    const audioBuffer = fs.readFileSync(`./uploads/audio/${filePath}`)
    const audioBlob = new Blob([audioBuffer])
    const formData = new FormData()
    formData.append('file', audioBlob)

Error is showing when i'm trying to append file to formdata

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You're using two different types called Blob

The one you are importing is from node:

import { Blob } from 'buffer' // this is from node

While the apis you are calling (FormData) are from the DOM and expect the Blob type defined in the DOM typings. These two Blob types are not the same

The fix is to remove the import for Blob. This should use the global Blob type defined in the DOM typings (provided you have explicitly excluded the DOM typings from your project)

about 4 years ago · Juan Pablo Isaza Relatório
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