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

182
Visualizações
Why does `WebSocket.binaryType` exist?

WebSocket has a .binaryType property that determines whether received data is exposed as a Blob or an ArrayBuffer. Why? ArrayBuffer allows you to process the data in a synchronous fashion, but what's the benefit of Blob, and why is it the default?

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

0

An ArrayBuffer would have to be fully read before it could be used, and all of the data would have to be in memory at the same time. In contrast, a Blob can be read as a stream, avoiding having to have all the data in memory before you can do anything with it (or at all).

For many purposes, incremental processing of the data from a stream is what you want (such as playing audio or video).

For some purposes, you really need all the data before you can do anything with it, in which case you might use an ArrayBuffer.

As for why Blob is the default, I'll speculate that it's because it's more flexible. When you need incremental processing, you can get it via the Blob (using a stream) without waiting for all the data, and if you need all the data before you start, you can always get an ArrayBuffer from the Blob via its arrayBuffer method.

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