Shuttle.Streams 21.0.1

Prefix Reserved
dotnet add package Shuttle.Streams --version 21.0.1
                    
NuGet\Install-Package Shuttle.Streams -Version 21.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Shuttle.Streams" Version="21.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Shuttle.Streams" Version="21.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Shuttle.Streams" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Shuttle.Streams --version 21.0.1
                    
#r "nuget: Shuttle.Streams, 21.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Shuttle.Streams@21.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Shuttle.Streams&version=21.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Shuttle.Streams&version=21.0.1
                    
Install as a Cake Tool

Shuttle.Core.Streams

Shuttle.Core.Streams provides essential Stream extension methods to simplify common operations like copying and byte array conversion.

Installation

dotnet add package Shuttle.Core.Streams

Stream Extensions

Task<byte[]> ToBytesAsync()

Creates an array of bytes from the given stream. The source stream's position is preserved throughout the operation (it is restored to its original state once the operation completes).

Task<Stream> CopyAsync()

Returns a copy of the given stream as a MemoryStream.

Optimizations:

If the source stream is a MemoryStream and its internal buffer is accessible, CopyAsync will return a read-only MemoryStream over the same buffer (a zero-copy operation). Otherwise, a standard MemoryStream is used and the source data is copied.

Positioning:

  • The returned copy will be positioned at 0.
  • The source stream's position is preserved (restored to its original state).

Usage

using Shuttle.Core.Streams;

// ... inside an async method ...

// Convert a stream to a byte array
byte[] data = await myStream.ToBytesAsync();

// Create an efficient copy of a stream
using (Stream copy = await myStream.CopyAsync())
{
    // work with the copy, myStream position remains unchanged
}
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Shuttle.Streams:

Package Downloads
Shuttle.Recall

Event sourcing mechanism.

Shuttle.Hopper

Hopper is a flexible enterprise service bus which works with Azure Storage Queues, Amazon SQS, RabbitMQ, Kafka, and Event Hubs through a provider plugin API.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
21.0.1 201 4/15/2026
21.0.1-rc3 223 4/11/2026