Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 1.41 KB

README.md

File metadata and controls

60 lines (42 loc) · 1.41 KB

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