getFile method

Future<void> getFile(
  1. PathUri path,
  2. File file, {
  3. void onProgress(
    1. double progress
    )?,
})

Gets the content of the file at path.

If the response is empty the file will be created with no data.

Implementation

Future<void> getFile(
  PathUri path,
  File file, {
  void Function(double progress)? onProgress,
}) async {
  final sink = file.openWrite();
  final stream = getStream(
    path,
    onProgress: onProgress,
  );
  await stream.pipe(sink);
  await sink.close();
}