MeatPack.NET 0.2.0

dotnet add package MeatPack.NET --version 0.2.0
                    
NuGet\Install-Package MeatPack.NET -Version 0.2.0
                    
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="MeatPack.NET" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeatPack.NET" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="MeatPack.NET" />
                    
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 MeatPack.NET --version 0.2.0
                    
#r "nuget: MeatPack.NET, 0.2.0"
                    
#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 MeatPack.NET@0.2.0
                    
#: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=MeatPack.NET&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=MeatPack.NET&version=0.2.0
                    
Install as a Cake Tool

MeatPack.NET

A .NET encoder and decoder for MeatPack, Scott Mudge's G-code packing scheme (BSD-3-Clause; see LICENSE.meatpack), used by Marlin hosts over serial and by Prusa's binary G-code container for its G-code blocks.

The scheme packs the fifteen most common G-code characters two to a byte through a 4-bit table; 0b1111 in a nibble announces a full-width character, 0xFF announces two, and a doubled 0xFF introduces a command byte toggling packing or the no-spaces table variant (in which E takes the space's slot).

The packing is deliberately lossy — writers strip spaces from G-command lines and pad odd-length lines with a newline — so the decoder also owes the reconstruction the reference implementations perform: a space re-inserted before each parameter letter on a G line, the padding after a newline dropped, and consecutive newlines collapsed. The output is equivalent G-code, not the packer's original bytes. This behaviour is pinned against real PrusaSlicer output in the libbgcode.NET repository this package is developed in.

There is no malformed MeatPack — unknown commands are ignored, every other byte is packed data or passthrough — so decoding never throws, and the output is bounded by a small constant multiple of the input.

Usage

using MeatPack.NET;

byte[] gcodeText = MeatPackDecoder.Unpack(packedBytes);

// And the other direction - the reference packer's line treatment exactly:
// comments kept or dropped, inline comments cut, G-lines space-stripped with
// serial checksums recomputed, the no-spaces table variant on by default.
byte[] packed = MeatPackEncoder.Pack("G1 X10 Y20\nM104 S210\n", keepComments: true);

License

Mozilla Public License 2.0. The MeatPack scheme itself is Scott Mudge's, BSD-3-Clause, carried in LICENSE.meatpack.

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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MeatPack.NET:

Package Downloads
libbgcode.NET

A .NET reader and writer for Prusa's binary G-code (bgcode) container format: file header, block enumeration, per-block compression (deflate, heatshrink), MeatPack G-code encoding and decoding, CRC-32 checksums, the JSON metadata PrusaSlicer 3 writes, and whole-file conversion to and from ASCII G-code. Implemented from the published format specification; the reader is hardened against untrusted input, the writer cannot produce a file the reference implementation refuses.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 206 9/5/2026
0.1.0 94 9/1/2026