Documentation
¶
Overview ¶
Package extract turns Office Open XML (Word, Excel, PowerPoint) and OpenDocument files into plain text, in process, with the standard library only. Documents are untrusted: every read is bounded (entries, bytes per part, bytes per document, bytes in one tag, nesting depth, text produced, row size), and no declaration or entity is processed.
Index ¶
Constants ¶
const ( MaxParts = 10000 // zip entries MaxPartBytes = 64 << 20 // decompressed bytes of one part MaxTotalBytes = 256 << 20 // decompressed bytes of all parts read MaxText = 16 << 20 // bytes of text produced; beyond it the result is Truncated MaxTag = 1 << 20 // bytes in one tag, its attributes included MaxDepth = 4096 // elements open at once MaxDirectory = 4 << 20 // bytes of the archive's central directory )
Limits. A document needing more is refused, never partly decompressed into memory.
Variables ¶
var ( // ErrUnsupported means the file is not a document of its kind: not a zip, or a required part // is missing or not well-formed XML. ErrUnsupported = errors.New("not a readable document") // ErrTooLarge means a limit stopped the read before any text could be trusted complete. ErrTooLarge = errors.New("document too large to extract") )