appendBlock method

Future<void> appendBlock(
  1. String path, {
  2. String? body,
  3. Uint8List? bodyBytes,
})

Append block to blob.

Implementation

Future<void> appendBlock(
  String path, {
  String? body,
  Uint8List? bodyBytes,
}) async {
  var request = http.Request('PUT', uri(path: path, queryParameters: {'comp': 'appendblock'}));
  if (bodyBytes != null) {
    request.bodyBytes = bodyBytes;
  } else if (body != null) {
    request.body = body;
  }
  _sign(request);
  var res = await request.send();
  if (res.statusCode == 201) {
    await res.stream.drain();
    return;
  }

  var message = await res.stream.bytesToString();
  throw AzureStorageException(message, res.statusCode, res.headers);
}