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

90
Views
http.get nodejs lambda wrong encoding for png image

I am using node.js (aws lambda) to perform a simple get request for a .png image on an external server. The data that I'm getting back seems to be encoded incorrectly, but I cant figure out how or why to get the correct encoding. the length and structure of the data seems to be the same (as shown in the images), but I just cant figure out why I dont get the same data...ive tried converting to base64, utf-8, etc.

my function:

http.get(FinalURL, function(res) {
            res.on('data', function(d) {
                body += d;
            });
            res.on('end', function() {
                resolve(body);
            });
            res.on('error', function(e) {
                resolve(e.message);
            });
        });

INCORRECT ENCODING

CORRECT ENCODING

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I was able to get it to work by downloading it as binary using

res.setEncoding('binary');

i think this simplifies the characters and then its able to understand what its downloading

about 4 years ago · Juan Pablo Isaza Report
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!