ConcurrentFileWriter 1.0.1

.NET Framework 4.0
There is a newer version of this package available.
See the version list below for details.
Install-Package ConcurrentFileWriter -Version 1.0.1
dotnet add package ConcurrentFileWriter --version 1.0.1
<PackageReference Include="ConcurrentFileWriter" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConcurrentFileWriter --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ConcurrentFileWriter, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ConcurrentFileWriter as a Cake Addin
#addin nuget:?package=ConcurrentFileWriter&version=1.0.1

// Install ConcurrentFileWriter as a Cake Tool
#tool nuget:?package=ConcurrentFileWriter&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

A class library for managing multi-threaded sequential write access to one or more files.
It is capable of flushing writes from multiple threads in batches by either hitting a specified size threshold or a specified inactivity time limit. It is also possible to write this batching information within the output file(s).
Note: This class should be injected as a single or static instance shared across all process threads.
Files will be locked exclusively from the first Write() call until FlushAndClose() is called or the class is disposed.

The ConcurrentFileWriter class can be found as an extension of System.IO

*** Full debugging source/symbols are available from

Usage Example:

var cfw = new ConcurrentFileWriter(new ConcurrentFileWriterSettings {
            flushTimeInMilliseconds = 5000,
            flushSizeInBytes = 10000,
            showWriteBatchingMarkers = true

//Pre-lock file (not required)
cfw.Write(@"c:\temp\test.log", null);

//Append a string (byte arrays can also be directly written)
cfw.WriteUtf8Line(@"c:\temp\test.log", "Test Line");

//Flush and unlock specified file (stop managing)

//Flush and unlock all managed files

Product Versions
.NET Framework net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 1,309 11/30/2015
1.0.1 1,195 11/30/2015
1.0.0 4,303 11/28/2015

* Now flushes & closes all managed files on destructor of ConcurrentFileWriter class (not just on disposal).