startDownloadToFile method

DownloadTask startDownloadToFile(
  1. File file
)

Starts a download of the object into file that can be paused, resumed and canceled, and resumes by itself after a network failure; see DownloadTask.

The bytes go to a new file next to file (<file>.<random>.part), which is renamed to file once the download is complete, replacing a file already there. When the download fails or is canceled, the partial file is deleted and file is left untouched. The directory of file must exist.

Throws invalid-root-operation on the root of the bucket; other errors come through DownloadTask.result.

Implementation

DownloadTask startDownloadToFile(File file) {
  throwIfRoot('startDownloadToFile');
  return DownloadTask.start(this, file);
}