cfb

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 7 Imported by: 0 modules, 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 cfb reads Microsoft Compound File Binary files ([MS-CFB]), the "OLE2" container of legacy Office formats: .xls, .doc, .ppt and Outlook .msg. A compound file is a small file system: storages (directories) holding streams (files). This package reads it; it does not write.

It reads untrusted files: chains that loop, sectors past the end, and sizes that do not fit are errors, never hangs or panics.

Index

Constants

View Source
const MaxStream = 256 << 20

MaxStream bounds the size of one stream Read returns.

Variables

This section is empty.

Functions

func Is

func Is(head []byte) bool

Is reports whether data starts like a compound file.

Types

type Entry

type Entry struct {
	Name     string
	IsStream bool
	Size     uint64
	// contains filtered or unexported fields
}

Entry is a storage or stream.

func (*Entry) Child

func (e *Entry) Child(name string) *Entry

Child returns the named child, or nil. Names compare without regard to case, as [MS-CFB] 2.6.4 has them compared.

func (*Entry) Children

func (e *Entry) Children() []*Entry

Children lists a storage's entries.

func (*Entry) Read

func (e *Entry) Read() ([]byte, error)

Read returns a stream's data.

type File

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

File is an opened compound file.

func Open

func Open(r io.ReaderAt, size int64) (*File, error)

Open reads a compound file's structure.

func (*File) Root

func (f *File) Root() *Entry

Root returns the root storage.

Jump to

Keyboard shortcuts

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