Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

122
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!