- Joined
- Oct 24, 2012
- Messages
- 6,545
Hello again. I am currently using File.Copy method but I was wondering about using the FileStream.CopyToAsync method.
Speed is essential so I am trying to see which is faster / better to use. ( less error prone). The files range in size from as small as 1 byte to as large as a few gb. (max is around 10gb atm but that can easily change)
I have tried this and it is marginally faster.
I was wondering if there is a better more efficient way to copy files from one location to another ? Also what are the advantages of using an Async copy vs File.Copy ? What other methods of copying is there and what is preferred ? Any help is greatly appreciated.
Speed is essential so I am trying to see which is faster / better to use. ( less error prone). The files range in size from as small as 1 byte to as large as a few gb. (max is around 10gb atm but that can easily change)
I have tried this and it is marginally faster.
JASS:
using (FileStream SourceStream = File.Open(fileName, FileMode.Open, FileAccess.Read))
{
using (FileStream DestinationStream = File.Create(fileDestination))
{
await SourceStream.CopyToAsync(DestinationStream);
}
}