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

114
Vistas
send base64 image with correct headers in express

i got this code, i already know that data is correct, i try to send the base64 string to the client without the preFix of 'data:image/jpg;base64,'
but i think i dont have the correct headers that will show the image, where ever i try it's don't work without the preFix,

app.get('/image', async (req, res, next) => {
    let data = img.toString('base64');
    let length = data.length;
    res.header('Content-Type', 'image/jpg');
    res.header('Content-Length', String(length));
    res.send(data); //without 'data:image/jpg;base64,'
})

i want that in the client all i will need to do is - img.src = http.get('/image')
anyone, help? 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