little-creeper / AsyncCopyTo

A small CopyToAsync extension for C# Streams that features progress monitoring.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AsyncCopyTo

A small CopyToAsync() extension for C# Streams that features progress monitoring.

Features:

  • Reports progress to a user provided IProgress instance.
  • Reads new chunks from source stream concurrently to writing the previously read chunks to the destination.

Usage

Stream sourceStream;
Stream destinationStream;
IProgress<long> progress = new SomeProgressImplementation();
int bufferSize = 1024; // optional

sourceStream.CopyToAsync(destinationStream, progress, bufferSize);

// continue work while source gets copied to destination and with regular progress reports after each bufferSize bytes

About

A small CopyToAsync extension for C# Streams that features progress monitoring.


Languages

Language:C# 100.0%