putStream method
Puts a new file at path
with localData
as content.
contentLength
sets the length of the localData
that is uploaded.
lastModified
sets the date when the file was last modified on the server.
created
sets the date when the file was created on the server.
checksum
has to follow checksumPattern. It will not be validated by the server.
onProgress
can be used to watch the upload progress. Possible values range from 0.0
to 1.0
.
See:
- http://www.webdav.org/specs/rfc2518.html#METHOD_PUT for more information.
- putStream_Request for the request sent by this method.
Implementation
Future<http.StreamedResponse> putStream(
Stream<List<int>> localData,
PathUri path, {
required int contentLength,
DateTime? lastModified,
DateTime? created,
String? checksum,
void Function(double progress)? onProgress,
}) async {
final request = putStream_Request(
localData,
path,
lastModified: lastModified,
created: created,
checksum: checksum,
contentLength: contentLength,
onProgress: onProgress,
);
final streamedResponse = await httpClient.send(request);
if (streamedResponse.statusCode != 201 && streamedResponse.statusCode != 204) {
final response = await http.Response.fromStream(streamedResponse);
throw DynamiteStatusCodeException(response);
}
return streamedResponse;
}