Example #1
0
        protected const int BufferSize = 1 << 20;         // 1MB

        public virtual async Task DownloadFile(string downloadUrl, FsPath downloadTarget, CancellationToken token)
        {
            using var stream = await DownloadStream(downloadUrl, token);

            using var fileStream = downloadTarget.OpenFile(FileMode.Create);
            await stream.CopyToAsync(fileStream, BufferSize, token);
        }