BymlLibrary 2.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package BymlLibrary --version 2.1.1                
NuGet\Install-Package BymlLibrary -Version 2.1.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="BymlLibrary" Version="2.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BymlLibrary --version 2.1.1                
#r "nuget: BymlLibrary, 2.1.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.
// Install BymlLibrary as a Cake Addin
#addin nuget:?package=BymlLibrary&version=2.1.1

// Install BymlLibrary as a Cake Tool
#tool nuget:?package=BymlLibrary&version=2.1.1                

<div align="center"> <img src="https://github.com/EPD-Libraries/BymlLibrary/blob/master/icon.png" width="100vh"> <h1>-   BYML Library   -</h1> </div>

Modern Binary Yml IO library written in managed C#

Supports versions 2-7.

[!NOTE] Some v7 nodes may not be supported, but everything used in TotK is.

Usage

Reading a Byml File

using BymlLibrary;
using Revrs;

byte[] data = File.ReadAllBytes("path/to/file.byml");
Byml byml = Byml.FromBinary(data);

Reading a Byml for Read-Only use (Much Faster)

using BymlLibrary;
using Revrs;

byte[] data = File.ReadAllBytes("path/to/file.byml");
RevrsReader reader = new(data);
ImmutableByml byml = new(ref reader);

Writing a Byml File

/* ... */

// Avoid writing directly to
// a file stream. Seeking is
// much slower and used extensively
// during serialization.
using MemoryStream ms = new();
byml.WriteBinary(ms, Endianness.Little);

// Write to a byte[]
byte[] data = byml.ToBinary(Endianness.Little);

Benchmarks

Benchmarks for Actors/ActorInfo.product.byml (BotW for Switch | 1.9 MB)

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Read 66.97 ms 1.299 ms 1.984 ms 3250.0000 3125.0000 625.0000 40.04 MB
ReadImmutable 15.97 ns 0.245 ns 0.217 ns - - - -
Write 35.86 ms 0.712 ms 1.266 ms 666.6667 400.0000 266.6667 16.34 MB
ToBinary 36.02 ms 0.714 ms 1.376 ms 714.2857 500.0000 285.7143 18.24 MB
ToYaml 35.87 ms 0.713 ms 0.902 ms 1785.7143 1142.8571 214.2857 34.07 MB
FromYaml 384.21 ms 7.684 ms 9.436 ms 14000.0000 13000.0000 1000.0000 199.68 MB

Benchmarks for GameData/GameDataList.Product.110.byml (TotK 1.2.1 | 12.4 MB)

Method Mean Error StdDev Gen0 Gen1 Gen2 Allocated
Read 263.8 ms 4.49 ms 6.58 ms 12500.0000 12000.0000 500.0000 188.49 MB
ReadImmutable 16.52 ns 0.282 ns 0.231 ns - - - -
Write 275.8 ms 5.48 ms 14.43 ms 2000.0000 1000.0000 - 153.85 MB
ToBinary 275.0 ms 5.49 ms 14.76 ms 2000.0000 1000.0000 - 164.53 MB
ToYaml 133.6 ms 2.54 ms 2.61 ms 5500.0000 4500.0000 250.0000 117.81 MB
FromYaml 1,960.0 ms 36.65 ms 34.28 ms 71000.0000 43000.0000 2000.0000 1043.85 MB

Benchmarks for the test file (contains one of every node in a Map)

Method Mean Error StdDev Gen0 Gen1 Allocated
Read 1.587 μs 0.0154 μs 0.0144 μs 0.2384 0.0019 3.68 KB
ReadImmutable 16.13 ns 0.074 ns 0.066 ns - - -
Write 4.486 μs 0.0872 μs 0.1004 μs 0.6332 0.0076 9.73 KB
ToBinary 4.370 μs 0.0530 μs 0.0442 μs 0.6714 0.0076 10.35 KB
ToYaml 2.888 μs 0.0453 μs 0.0485 μs 0.3090 - 4.78 KB
FromYaml 23.004 μs 0.2572 μs 0.2280 μs 2.0447 0.1221 31.73 KB

[!NOTE] ns (nanoseconds) is not μs (microseconds)

Install

NuGet NuGet

NuGet
Install-Package BymlLibrary
Build From Source
git clone https://github.com/EPD-Libraries/BymlLibrary.git
dotnet build BymlLibrary

Special thanks to Léo Lam for his extensive research on EPD file formats.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.18 144 6/28/2024
2.1.17 100 6/27/2024
2.1.16 113 6/5/2024
2.1.15 106 6/5/2024
2.1.14 110 6/1/2024
2.1.13 112 5/6/2024
2.1.12 125 5/6/2024
2.1.11 187 4/23/2024
2.1.10 100 4/14/2024
2.1.9 126 4/12/2024
2.1.8 197 4/6/2024
2.1.7 119 4/6/2024
2.1.6 150 2/24/2024
2.1.5 139 2/4/2024
2.1.4 128 1/28/2024
2.1.3 88 1/28/2024
2.1.2 131 1/21/2024
2.1.1 122 1/18/2024
2.1.0 107 1/18/2024
2.0.6 129 1/16/2024
2.0.5 117 1/16/2024
2.0.4 103 1/15/2024
2.0.3 124 1/13/2024
2.0.2 121 1/13/2024
2.0.1 96 1/13/2024
2.0.0 124 1/13/2024
1.1.4 640 10/16/2022
1.1.3 393 8/18/2022
1.1.2 402 8/16/2022
1.1.1 437 7/11/2022
1.1.0 442 6/23/2022
1.0.7 432 6/23/2022
1.0.6 423 6/23/2022
1.0.5 422 6/20/2022
1.0.4 415 6/16/2022
1.0.3 409 6/8/2022
1.0.2 407 6/7/2022
1.0.1 406 6/4/2022
1.0.0 411 6/3/2022