embed

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 12 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 embed finds the objects a file of the three formats embeds as storages of its compound file, and hands each on as a file of its own.

A Word file keeps its objects in the storage ObjectPool, one storage each; a workbook keeps them at its root, in storages named MBD and eight digits. What such a storage holds is one of:

  • a file in a stream: "\x01Ole10Native" (a file of any kind, wrapped by the object packager, or the bytes of the program that made the object), "Package" (an Office Open XML file) or "CONTENTS" (what the embedding program wrote, a PDF for one). The bytes are handed on as they are.
  • a compound document: the streams of a Word, Excel or PowerPoint file, or of any other program that stores in compound files. The storage is written out as a compound file of its own.
  • a link to a file outside: counted, and not followed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Object

type Object struct {
	// Path is the storage's path from the root.
	Path []string
	// Link says the object is a link to a file outside, by the flag of
	// its "\x01Ole" stream ([MS-OLEDS] 2.3.3) or, in a workbook, by its
	// storage's name.
	Link bool
}

Object is an embedded object: a storage of the file.

func Find

func Find(f *cfb.File) (objects []Object, past int64)

Find lists the embedded objects of a file, in the order of its directory, and counts those past the bound on their number.

type Result

type Result struct {
	Children []*gofastcore.Document
	// Links counts the objects that are links to files outside.
	Links int
	// Damaged names the objects that could not be read.
	Damaged []string
	// Deep counts the objects whose storages nest too deep to write out.
	Deep int64
	// Limited says the decode budget ran out: the objects from there on
	// are listed and not read.
	Limited bool
}

Result is what Hand gives.

func Hand

func Hand(ctx context.Context, f *cfb.File, opts *gofastcore.Options, objects []Object, read bool) Result

Hand hands the embedded objects to the caller's child extractor. With no child extractor, or with read false, each is listed without being read. What is handed on is taken from the decode budget in ctx.

Jump to

Keyboard shortcuts

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