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

113
Visualizações
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 à 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