Skip to content

narkhedegs/Pipe

Repository files navigation

Build status

Pipe

Pipe streams in .NET without deadlocks.




Purpose

Pipe helps to "pipe" the streams in .NET without deadlocks.

Requirements

  • .NET 4.5 and above

Installation

Pipe is available at Nuget and can be installed as a package using VisualStudio NuGet package manager or via the NuGet command line:

Install-Package Pipe

Usage

using Narkhedegs;
var pipe = new Pipe();

// StreamReader could be output of any process. for ex. StandardOutput of System.Diagnostics.Process 
var processStream = streamReader.BaseStream; 

try
{
	int bytesRead;
    
	while(bytesRead = await processStream.ReadAsync(buffer, 0, buffer.Length).ConfigureAwait(false)) > 0)
    {
    	await pipe.InputStream.WriteAsync(buffer, 0, bytesRead).ConfigureAwait(false);
    }
}
finally
{
	processStream.Close();
    pipe.InputStream.Close();
}

Credits

All credits goes to madelson. This project is just a small part of MedallionShell published as a separate NuGet package.

License

MIT © narkhedegs

About

Pipe streams in .NET without deadlocks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published