DotNext by Roman Sakno

<PackageReference Include="DotNext" Version="2.4.0" />

 StreamSource

public static class StreamSource
Represents conversion of various buffer types to stream.
public static Stream AsStream(this ReadOnlySequence<byte> sequence)

Converts read-only sequence of bytes to a read-only stream.

public static Stream AsStream(this ReadOnlyMemory<byte> memory)

Converts read-only memory to a read-only stream.

public static Stream AsStream<TWriter>(this TWriter writer, Action<TWriter> flush = null, Func<TWriter, CancellationToken, Task> flushAsync = null) where TWriter : IBufferWriter<byte>

Returns the writable stream associated with the buffer writer.

public static Stream GetWrittenBytesAsStream(this PooledArrayBufferWriter<byte> writer)

Gets written content as a read-only stream.