Skip to content

Commit

Permalink
FileStream-Async
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams committed Apr 16, 2018
1 parent 82ecbbc commit 752f7ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions AsyncFileWriter/AsyncFileWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ public Task Complete()
async Task ProcessBytes()
{
var reader = _channel.Reader;
using (var fs = new FileStream(FilePath, FileMode.Append, FileAccess.Write, FileShareMode, bufferSize: 4096 * 4 /*, useAsync: true */))
using (var fs = new FileStream(FilePath, FileMode.Append, FileAccess.Write, FileShareMode, bufferSize: 4096 * 4 , useAsync: true))
{
while (await reader.WaitToReadAsync().ConfigureAwait(false))
{
while (reader.TryRead(out byte[] bytes))
{
//await fs.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
fs.Write(bytes, 0, bytes.Length);
await fs.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
//fs.Write(bytes, 0, bytes.Length);
}
}

Expand Down

0 comments on commit 752f7ef

Please sign in to comment.