statObject method

Future<StatObjectResult> statObject(
  1. String bucket,
  2. String object
)

Stat information of the object.

Implementation

Future<StatObjectResult> statObject(String bucket, String object) 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: await getObjectACL(bucket, object),
  );
}