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

261
Vistas
Calculating the ETag for a local file in Node.js while uploading to AWS S3

I'm currently trying to implement a system that verifies the integrity of files I upload to S3. Through the AWS SDK for JavaScript, I am able to retrieve the ETag of the remote object, however, the MD5 hash for my local object doesn't match the ETag. I am currently using crypto for generating it, as follows:

var hash = crypto.createHash('md5');
stream = fs.createReadStream(localfile);

stream.on('data', function (data) {
  hash.update(data, 'utf8')
})

stream.on('end', function () {
  md5 = hash.digest('hex');

  < rest of the code >
});

According to all the results I've found while looking for answers, the ETags for S3 objects should be simple MD5 hashes: e.g. the AWS documentation (emphasis mine):

To ensure that data is not corrupted traversing the network, use the Content-MD5 header. When you use this header, Amazon S3 checks the object against the provided MD5 value and, if they do not match, returns an error. Additionally, you can calculate the MD5 while putting an object to Amazon S3 and compare the returned ETag to the calculated MD5 value.

However, my local hash doesn't match the remote ETag. Am I missing anything here?

Thanks for your time!

Clarification: I'm only uploading small plain text files, and I'm not dealing with multi-part uploads. I've seen that a lot of questions around the web are in regards to multi-part uploads, but this is just for simple uploads. Thanks!

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Problem Exists Between Keyboard And Chair. The issue was with the actual file uploads and not with the md5 sum. See the comment section in the original question.

about 4 years ago · Santiago Trujillo 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