putBlobStreaming method
Streams file contents to the publisher without loading everything into memory.
Implementation
Future<Map<String, dynamic>> putBlobStreaming({
required File file,
String? encodingType,
int? epochs,
bool? deletable,
String? sendObjectTo,
String? jwtToken,
}) async {
if (!await file.exists()) {
throw FileSystemException('File does not exist', file.path);
}
logInfo('Streaming upload for file ${file.path}');
final uri = _publisherUri(
'v1/blobs',
queryParameters: _buildQueryParameters(
epochs: epochs,
deletable: deletable,
sendObjectTo: sendObjectTo,
),
);
final response = await _executor.send(
method: 'PUT',
uri: uri,
headers: _buildHeaders(jwtToken: jwtToken),
bodyStream: file.openRead(),
);
final result = await _parseJsonResponse(
response,
context: 'Error uploading blob',
);
logInfo('Streaming upload completed with status ${response.statusCode}');
return result;
}