statObject method

Future<StatObjectResult> statObject(
  1. String bucket,
  2. String object, {
  3. bool retrieveACLs = true,
})

Stat information of the object.

Implementation

Future<StatObjectResult> statObject(
  String bucket,
  String object, {
  bool retrieveACLs = true,
}) async {
  MinioInvalidBucketNameError.check(bucket);
  MinioInvalidObjectNameError.check(object);

  final resp = await _client.request(
    method: 'HEAD',
    bucket: bucket,
    object: object,
  );

  validate(resp, expect: 200);

  var etag = resp.headers['etag'];
  if (etag != null) {
    etag = trimDoubleQuote(etag);
  }

  return StatObjectResult(
    etag: etag,
    size: int.parse(resp.headers['content-length']!),
    metaData: extractMetadata(resp.headers),
    lastModified: parseRfc7231Time(resp.headers['last-modified']!),
    acl: retrieveACLs ? await getObjectACL(bucket, object) : null,
  );
}