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

151
Vistas
How can I send an image from a WebSocket in Blazor?

I'm trying to send image from Blazor to JS with a WebSocket, I don't know the way. I'm trying to send a base64 or byte[] but Base64string if I upload really big images use all the memory and it collapse and the app stop working. I'm trying to send a byte[] but I'm not sure how to make that, and next I have to download the image on the server. So I need to convert that byte[] to an image.

There is how I transform the file to a byte[]:

        public async Task<byte[]> GetByteArrayFromFile(IBrowserFile imageFile)
        {

            var resizedImage = await imageFile.RequestImageFileAsync("image/jpg", 40000, 20000);
            Stream jsImageStrea = resizedImage.OpenReadStream(1073741824);
            MemoryStream ms = new MemoryStream();
            await jsImageStrea.CopyToAsync(ms);
            return ms.ToArray();
        }

I'm using this to transform byte[] to base64

Convert.ToBase64String(byte[])

If someone can help I would appreciate it, thanks.

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