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);

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

  final file = File(filePath);
  final stat = await file.stat();
  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: metadata,
  );
}