zipdoc

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 8 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 zipdoc reads documents which are zip archives, such as office documents and EPUB books: the archive, the XML files in it, and the images in it, such as a thumbnail or a cover

Index

Constants

View Source
const (
	// MaxXMLSize is the largest XML file within a document which is
	// decompressed, so a small archive can't decompress to fill memory
	MaxXMLSize = 1 << 20

	// MaxImageSize is the largest image within a document which is read, in
	// bytes
	MaxImageSize = 16 << 20
)

Variables

This section is empty.

Functions

func Image

func Image(archive *zip.Reader, name, key string, o *metadata.Opts) metadata.Metadata

Image returns the image in the archive with the name as artwork, with the key, downscaled to fit the largest image dimension when it's larger, or nil when there's none, or it can't be decoded, such as a Windows metafile, which some documents' thumbnails are

func Open

func Open(r io.Reader, maxSize int64) (*zip.Reader, bool, error)

Open returns the document's zip archive, which is read in place when the reader can be read at any offset, and has a size, as Extract's readers do, so only the files in it which are read are, and otherwise from memory, unless it's larger than maxSize, when it's false

func ReadXML

func ReadXML(archive *zip.Reader, name string, v any) error

ReadXML decodes the XML file in the archive with the name into v, which is decompressed up to MaxXMLSize, or returns ErrNotFound when there's no such file

Types

This section is empty.

Jump to

Keyboard shortcuts

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