fPutObject method

Future<String> fPutObject(
  1. String bucket,
  2. String object,
  3. String filePath, [
  4. Map<String, String>? metadata,
])

Implementation

Future<String> fPutObject(
  String bucket,
  String object,
  String filePath, [
  Map<String, String>? metadata,
]) async {
  MinioInvalidBucketNameError.check(bucket);
  MinioInvalidObjectNameError.check(object);

  var meta = metadata ?? {};
  meta = insertContentType(meta, filePath);
  meta = prependXAMZMeta(meta);

  final file = File(filePath);
  final stat = file.statSync();
  if (stat.size > maxObjectSize) {
    throw MinioError(
      '$filePath size : ${stat.size}, max allowed size : 5TB',
    );
  }

  return putObject(
    bucket,
    object,
    file.openRead().cast<Uint8List>(),
    size: stat.size,
    metadata: meta,
  );
}