A lightweight .NET library for reading Binary II archive files (.bny, .bxy). Binary II is a wrapper format developed by Gary B. Little to preserve ProDOS file attributes during file transfers on Apple II computers. A single Binary II file can hold multiple disk files, making it easy to keep related files "glued" together.
- Read Binary II archives (.bny, .bxy files)
- Support for archives containing multiple files
- Parse file information headers with full metadata preservation
- Extract file data with 128-byte boundary alignment
- Preserve ProDOS file attributes:
- File type and auxiliary type
- Access flags (read, write, delete, etc.)
- Storage type
- Creation and modification dates
- Support for GS/OS extended attributes
- Support for multiple operating systems:
- ProDOS/SOS
- DOS 3.3/3.2
- Apple II Pascal
- Macintosh HFS/MFS
- MS-DOS
- CP/M
- And more
- Zero external dependencies (core library)
- Built for .NET 9.0
Add the project reference to your .NET application:
dotnet add reference path/to/BinaryIIReader.csprojOr, if published on NuGet:
dotnet add package BinaryIIReaderusing BinaryIIReader;
// Open a Binary II archive file
using var stream = File.OpenRead("archive.bny");
// Parse the archive
var archive = new BinaryIIArchive(stream);
// Get archive information
Console.WriteLine($"Total Entries: {archive.Count}");// Enumerate all entries in the archive
foreach (var entry in archive.Entries)
{
var header = entry.Header;
Console.WriteLine($"{header.FileName}");
Console.WriteLine($" OS Type: {header.OperatingSystemType}");
Console.WriteLine($" File Type: 0x{header.FileType:X2}");
Console.WriteLine($" Aux Type: 0x{header.AuxType:X4}");
Console.WriteLine($" Storage Type: {header.StorageType}");
Console.WriteLine($" File Length: {header.FileLength} bytes");
Console.WriteLine($" Files to Follow: {header.FilesToFollow}");
}foreach (var entry in archive.Entries)
{
var fileName = entry.Header.FileName.ToString();
// Extract file data as byte array
var data = entry.GetData();
File.WriteAllBytes(fileName, data);
// Or extract to a stream
using var outputStream = File.Create($"{fileName}.out");
entry.GetData(outputStream);
}Binary II archives can contain multiple files in series. Each header's FilesToFollow byte indicates how many files remain:
using var stream = File.OpenRead("multi-file.bny");
var archive = new BinaryIIArchive(stream);
Console.WriteLine($"Archive contains {archive.Count} file(s)");
for (int i = 0; i < archive.Count; i++)
{
var entry = archive[i];
Console.WriteLine($"Entry {i + 1}: {entry.Header.FileName}");
Console.WriteLine($" Files to follow: {entry.Header.FilesToFollow}");
}The main class for reading Binary II archives. Implements IReadOnlyList<BinaryIIEntry>.
BinaryIIArchive(Stream stream)- Opens an archive from a streamCount- Gets the number of entries in the archiveEntries- Gets a read-only collection of all entriesthis[int index]- Gets the entry at the specified indexGetEnumerator()- Enumerates all entries
Represents a single file entry within the archive:
Header- Gets the file information headerGetData()- Extracts the file data as a byte arrayGetData(Stream destination)- Copies the file data to a stream
Contains file-level metadata (128 bytes):
ProDOS Attributes:
AccessCode- ProDOS access flagsFileType- ProDOS file typeAuxType- ProDOS auxiliary typeStorageType- ProDOS storage typeSizeInBlocks- File size in 512-byte blocksFileLength- File length in bytes (EOF)FileName- File name (max 64 characters)CreationDate/CreationTime- Creation timestampModificationDate/ModificationTime- Modification timestamp
Archive Information:
FilesToFollow- Number of files remaining in the archiveDiskSpaceNeeded- Total disk space needed (first entry only)Version- Binary II format version (0 or 1)
Operating System:
OperatingSystemType- Native OS typeNativeFileType- Native file type (16-bit)
Data Flags:
DataFlags- Compression/encryption flagsPhantomFileFlag- Phantom file indicator
GS/OS Extended Attributes:
GsosAuxTypeHigh- GS/OS auxiliary type high wordGsosAccessHigh- GS/OS access high byteGsosFileTypeHigh- GS/OS file type high byteGsosStorageTypeHigh- GS/OS storage type high byteGsosSizeInBlocksHigh- GS/OS file size in blocks high wordGsosEofHigh- GS/OS EOF high byte
Helper Properties:
TotalEntrySize- Total size including header and padded dataIsBinaryII(ReadOnlySpan<byte>)- Static method to check for Binary II signature
ProDOS_SOS- ProDOS or SOSDOS_3_3- Apple DOS 3.3DOS_3_2- Apple DOS 3.2 or 3.1AppleII_Pascal- Apple II PascalMacintosh_MFS- Macintosh MFSMacintosh_HFS- Macintosh HFSLisa- Lisa Filing SystemApple_CP_M- Apple CP/MMS_DOS- MS-DOSHighSierra- High Sierra (CD-ROM)ISO_9660- ISO 9660 (CD-ROM)AppleShare- AppleShare
Compressed- File is compressedEncrypted- File is encryptedSparse- File is sparse
A Binary II file containing multiple files is structured as a series of header/data pairs:
start end
-------------------------------------------------------------------
| Header #1 | #1 Data | Header #2 | #2 Data | Header #3 | #3 Data |
-------------------------------------------------------------------
+127 = 2 +127 = 1 +127 = 0
- Each header is exactly 128 bytes
- Data areas are padded to 128-byte boundaries
- The
FilesToFollowbyte (offset 127) indicates remaining files - Last file has
FilesToFollow = 0
Build the project using the .NET SDK:
dotnet buildRun tests:
dotnet testExtract files from Binary II archives using the command-line dumper tool.
dotnet build dumper/BinaryIIDumper.csproj -c Releasedotnet run --project dumper/BinaryIIDumper.csproj -- <input> [-o|--output <path>]Arguments:
<input>: Path to the Binary II archive file (.bny, .bxy)-o|--output: Destination directory for extracted files (defaults to archive name)
Example:
dotnet run --project dumper/BinaryIIDumper.csproj -- archive.bny -o extracted_filesOutput:
Archive: archive.bny
Total Entries: 3
Output Directory: /path/to/extracted_files
Extracting: MYFILE
OS Type: ProDOS_SOS
Type: 0x06 Aux: 0x0000 Storage: Standard
File Length: 4096 bytes
Files to Follow: 2
Data: /path/to/extracted_files/MYFILE (4 KB)
Extracting: README
OS Type: ProDOS_SOS
Type: 0x04 Aux: 0x0000 Storage: Standard
File Length: 1024 bytes
Files to Follow: 1
Data: /path/to/extracted_files/README (1 KB)
Extracting: DATA.BIN
OS Type: ProDOS_SOS
Type: 0x00 Aux: 0x0000 Storage: Standard
File Length: 512 bytes
Files to Follow: 0
Data: /path/to/extracted_files/DATA.BIN (512 B)
Extraction complete: /path/to/extracted_files
- .NET 9.0 or later
MIT License. See LICENSE for details.
Copyright (c) 2026 Hugh Bellamy
Binary II was created by Gary B. Little in 1986 as a way to preserve Apple II file attributes during file transfers. Before Binary II, transferring files between Apple II computers via modems or bulletin board systems would lose important metadata like file type, auxiliary type, and access permissions.
Key Features:
- Preserves ProDOS file attributes during transfer
- 128-byte header with comprehensive metadata
- Support for multiple files in a single archive
- Data padding to 128-byte boundaries
- Version 0 and version 1 format support
- GS/OS extended attribute support
File Extensions:
.bny- Binary II archive.bxy- Binary II wrapped ShrinkIt archive (contains compressed data)
Identification: Binary II files are identified by:
- Signature bytes:
$0A $47 $4C(linefeed, 'G', 'L') at offset 0 - ID byte:
$02at offset 18 ($12)
- AppleDiskImageReader - Reader for Apple II universal disk (.2mg) images
- AppleIIDiskReader - Reader for Apple II DOS 3.3 disk (.dsk) images
- ProDosVolumeReader - Reader for ProDOS (.po) volumes
- WozDiskImageReader - Reader for WOZ (.woz) disk images
- DiskCopyReader - Reader for Disk Copy 4.2 (.dc42) images
- MfsReader - Reader for MFS (Macintosh File System) volumes
- HfsReader - Reader for HFS (Hierarchical File System) volumes
- ResourceForkReader - Reader for Macintosh resource forks
- StuffItReader - Reader for StuffIt (.sit) archives