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

87
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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