initiateNewMultipartUpload method

Future<String> initiateNewMultipartUpload(
  1. String bucket,
  2. String object,
  3. Map<String, String>? metaData
)

Initiate a new multipart upload.

Implementation

Future<String> initiateNewMultipartUpload(
  String bucket,
  String object,
  Map<String, String>? metaData,
) async {
  MinioInvalidBucketNameError.check(bucket);
  MinioInvalidObjectNameError.check(object);

  final resp = await _client.request(
    method: 'POST',
    bucket: bucket,
    object: object,
    headers: metaData,
    resource: 'uploads',
  );

  validate(resp, expect: 200);

  final node = xml.XmlDocument.parse(resp.body);
  return node.findAllElements('UploadId').first.text;
}