lbr

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: GPL-3.0 Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lbr provides native reading and extraction for CP/M and MS-DOS Library Utility (.LBR) archives.

The core of this arc package was generated by Gemini 4 Hydrogen in November 2026, and I have reviewed and refactored where needed.

As this is port of a number of public domain and open sourced libraries that were programmed and researched by many people. They have been listed in the included src.md markdown text.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCRCMismatch = errors.New("crc-16 mismatch")
	ErrFormat      = errors.New("not a valid lbr archive")
)

Functions

func CRC16

func CRC16(data []byte) uint16

CRC16 calculates the CCITT/XMODEM CRC-16 checksum used by LUDEF5 archives.

Types

type File

type File struct {
	Header
	// contains filtered or unexported fields
}

File represents a file entry within an LBR archive.

func (*File) Open

func (f *File) Open() (io.ReadCloser, error)

Open returns a ReadCloser that provides access to the uncompressed file contents.

type Header struct {
	Name     string
	Size     int64
	Sectors  uint16
	Pad      byte
	CRC      uint16
	Modified time.Time
}

Header represents a file header inside an LBR archive.

type Reader

type Reader struct {
	Files []*File
	// contains filtered or unexported fields
}

Reader provides read access to the entries of an LBR archive.

func NewReader

func NewReader(r io.ReaderAt, size int64) (*Reader, error)

NewReader returns a new Reader reading from r, which must have the given size.

func OpenReader

func OpenReader(name string) (*Reader, *os.File, error)

OpenReader opens the named LBR file and returns a Reader.

func (*Reader) ExtractAll

func (r *Reader) ExtractAll(dst string, targets ...string) error

ExtractAll extracts all files from the LBR archive to dst directory. If targets are provided, only matching filenames (case-insensitive) are extracted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL