GenericReader 3.0.0
dotnet add package GenericReader --version 3.0.0
NuGet\Install-Package GenericReader -Version 3.0.0
<PackageReference Include="GenericReader" Version="3.0.0" />
<PackageVersion Include="GenericReader" Version="3.0.0" />
<PackageReference Include="GenericReader" />
paket add GenericReader --version 3.0.0
#r "nuget: GenericReader, 3.0.0"
#:package GenericReader@3.0.0
#addin nuget:?package=GenericReader&version=3.0.0
#tool nuget:?package=GenericReader&version=3.0.0
<div align="center">
🚀 GenericReader
A generic, extensible binary reader for .NET
Effortlessly read from files, streams, buffers, or spans with a single unified API.
</div>
📦 Installation
Install via NuGet:
Install-Package GenericReader
✨ Features
- Read from files, streams, buffers, and spans
- Generic
Read<T>()API for simplicity and flexibility - Lightweight and easy to integrate
🔧 Example Usage
using GenericReader;
// From file
using var fileReader = new GenericFileReader(@"C:\Test\Example.bin");
var numberFromFile = fileReader.Read<uint>();
// From stream
using var streamReader = new GenericStreamReader(GetStream());
var numberFromStream = streamReader.Read<uint>();
// From byte array
using var bufferReader = new GenericBufferReader(GetBuffer());
var numberFromBuffer = bufferReader.Read<uint>();
// From span
var spanReader = new GenericSpanReader(GetSpan());
var numberFromSpan = spanReader.Read<uint>();
🛡️ Corrupted Data
Every reader checks each read against the data before it reads or allocates anything, and all readers fail the same way:
| Exception | When |
|---|---|
EndOfStreamException |
The data ends before the read does, or the read starts past the end (even when it reads zero bytes) |
InvalidDataException |
The data contains a length that cannot be valid: a negative length prefix, an FString length whose byte count does not fit in an int, or a getter array larger than MaxArrayAllocationSize |
ArgumentOutOfRangeException |
An argument is invalid, such as a negative length, a position or seek target outside of [0, max], or a negative MaxArrayAllocationSize |
A read that fails does not move Position, with two exceptions:
- A length prefix that was read before the failure stays read.
- Reads made of several steps keep the steps that succeeded. The overloads with an offset keep their seek, and an array of FStrings or of getter elements keeps the elements it read.
Positions past the end are allowed, as with streams; reading there fails. After Dispose, the buffer, file and stream readers throw ObjectDisposedException for every read and every access to the position; Length stays available. Readers over memory return ReadOnlySpan<byte> and ReadOnlyMemory<byte> views of it. If a file or stream turns out shorter than the Length it had when the reader was created, the read throws EndOfStreamException, and the destination may hold part of the data.
ReadArray with a getter allocates the array before it reads any element, and an element may take no bytes at all, so its length cannot be checked against the data. MaxArrayAllocationSize limits the array size in bytes instead. The default is IGenericReader.DefaultMaxArrayAllocationSize, 256 MiB:
reader.MaxArrayAllocationSize = 64 * 1024 * 1024;
var entries = reader.ReadArray(() => new Entry(reader));
🤝 Contributing
Contributions are welcome and appreciated!
Whether it's fixing a typo, suggesting an improvement, or submitting a pull request — every bit helps.
📄 License
This project is licensed under the MIT License.
<div align="center">
⭐️ Star the repo if you find it useful!
Feel free to open an issue if you have any questions or feedback.
</div>
| 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. net11.0 is compatible. |
-
net10.0
- No dependencies.
-
net11.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on GenericReader:
| Package | Downloads |
|---|---|
|
CUE4Parse
C# Parser for Unreal Engine packages & assets |
|
|
EpicManifestParser
A .NET parser & downloader for EpicGames manifests |
|
|
AbioticEditor.Core
The engine behind the Abiotic Factor save editor: byte-exact GVAS save reading/writing, the player/world/metadata save models, game-data catalogs (items, recipes, skills, quest flags), and the plugin host. The desktop app and CLI are thin front-ends over this library. Bundles the Apache-2.0 UeSaveGame.Json and CUE4Parse assemblies it builds against. |
|
|
Usmap.NET
A .NET parser for .usmap files |
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on GenericReader:
| Repository | Stars |
|---|---|
|
FabianFG/CUE4Parse
|
|
|
GalaxySwapperOfficial/Galaxy-Swapper-v2
Revamp your Fortnite experience with our skin swapper designed for the latest version of Fortnite.
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 3.0.0 | 60 | 11/13/2026 | |
| 3.0.0-preview.1 | 53 | 11/13/2026 | |
| 2.3.0 | 102,945 | 12/4/2025 | |
| 2.2.5 | 1,230 | 10/16/2025 | |
| 2.2.4 | 499 | 5/18/2025 | |
| 2.2.3 | 3,338 | 3/26/2025 | |
| 2.2.2 | 593 | 3/26/2025 | |
| 2.2.1 | 356 | 12/4/2024 | |
| 2.2.0 | 8,485 | 11/15/2024 | |
| 2.1.2 | 2,978 | 4/4/2024 | |
| 2.1.1 | 404 | 3/31/2024 | |
| 2.1.0 | 317 | 3/31/2024 | |
| 2.0.0 | 290 | 3/31/2024 | |
| 1.0.3 | 9,761 | 10/16/2021 | |
| 1.0.2 | 940 | 8/6/2021 | |
| 1.0.1 | 924 | 3/23/2021 | |
| 1.0.0 | 651 | 3/19/2021 |