Robbiblubber.Spellbook.Backpack
3.2.2
dotnet add package Robbiblubber.Spellbook.Backpack --version 3.2.2
NuGet\Install-Package Robbiblubber.Spellbook.Backpack -Version 3.2.2
<PackageReference Include="Robbiblubber.Spellbook.Backpack" Version="3.2.2" />
<PackageVersion Include="Robbiblubber.Spellbook.Backpack" Version="3.2.2" />
<PackageReference Include="Robbiblubber.Spellbook.Backpack" />
paket add Robbiblubber.Spellbook.Backpack --version 3.2.2
#r "nuget: Robbiblubber.Spellbook.Backpack, 3.2.2"
#:package Robbiblubber.Spellbook.Backpack@3.2.2
#addin nuget:?package=Robbiblubber.Spellbook.Backpack&version=3.2.2
#tool nuget:?package=Robbiblubber.Spellbook.Backpack&version=3.2.2
robbiblubber.org Spellbook Backpack Library
The robbiblubber.org Spellbook Backpack Library appends a payload to a carrier file and reads it back, for example to attach data to an executable that reads it at runtime. It replaces the Prelude Library from the robbiblubber.org Utility Suite.
The library targets .NET 8 and .NET 10 and contains no platform-dependent code.
The repository can be found at https://bitbucket.org/robbiblubber/robbiblubber.spellbook.net/. API documentation is available from https://robbiblubber.lima-city.org/. For general information see http://robbiblubber.org/.
The robbiblubber.org Spellbook Backpack Library is provided under the MIT license and may be used without restrictions under the conditions of this license agreement.
Usage
using Robbiblubber.Spellbook.Backpack;
Packer.Append("setup.exe", "data.zip", "setup-data"); // optional tag
// read the payload of the running executable
string exe = Environment.ProcessPath!;
if(Packer.HasPayload(exe, "setup-data"))
{
Packer.Extract(exe, Path.Combine(Path.GetTempPath(), "data.zip"), "setup-data");
}
using Stream data = Packer.OpenPayload(exe, "setup-data"); // without a temporary file
Append()andAppendAsync()append a file, a stream or a byte array. If appending fails, the carrier is restored to its original length.HasPayload()andGetInfo()read the footer (length, tag, carrier length, hash);Verify()checks the payload against its hash.Extract(),TryExtract()andExtractAsync()write the payload to a file or a stream. A target file is only replaced when the payload is intact.ReadPayload()returns the payload as a byte array,OpenPayload()as a seekable read-only stream.Remove()removes the payload and restores the carrier.
Files are read with FileShare.ReadWrite | FileShare.Delete, so a running
executable can read its own payload.
File format
A packed file consists of the unchanged carrier, the payload and a footer of 84 bytes at the end of the file:
| Offset | Length | Content |
|---|---|---|
| 0 | 32 | SHA-256 hash of the payload |
| 32 | 8 | payload length (Int64, little endian) |
| 40 | 32 | tag (UTF-8, zero padded; all zero = no tag) |
| 72 | 2 | format version (UInt16, little endian; 1) |
| 74 | 2 | reserved (0) |
| 76 | 8 | magic RBBKPACK (ASCII) |
Reading only needs the end of the file, so the size of the carrier does not matter, and carrier and payload may contain any bytes. A file holds at most one payload; damaged payloads are detected by the hash.
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- No dependencies.
-
net8.0
- No dependencies.
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 |
|---|---|---|
| 3.2.2 | 98 | 10/23/2026 |