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

88
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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