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
<PackageReference Include="Shuttle.Streams" Version="21.0.1" />
<PackageVersion Include="Shuttle.Streams" Version="21.0.1" />
<PackageReference Include="Shuttle.Streams" />
paket add Shuttle.Streams --version 21.0.1
#r "nuget: Shuttle.Streams, 21.0.1"
#:package Shuttle.Streams@21.0.1
#addin nuget:?package=Shuttle.Streams&version=21.0.1
#tool nuget:?package=Shuttle.Streams&version=21.0.1
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 | Versions 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. |
-
net10.0
- Shuttle.Contract (>= 21.0.1)
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 |