How is the minio etag generated

Viewed 3188

Does anyone know how the minio etag is generated when you PUT an object? Is it a hash of the file and can we use it to prevent uploading the same file twice?

Many thanks!

1 Answers

etag is just a md5 hex string. You can simple test it like this:

MinioClient client = new MinioClient("your endpoint","your accesskey","your secretkey");
ObjectStat objectStat = client.statObject("test", "XW02.jpg");
System.out.println(objectStat);

InputStream inputStream = client.getObject("test", "XW02.jpg");
String md5 = DigestUtils.md5DigestAsHex(inputStream);
System.out.println(md5);
Related