/**
* `.docx` text extraction with no runtime dependency (design D2, D3).
*
* A `.docx` is a ZIP archive whose main text part is `word/document.xml`. Node's
* `zlib.inflateRawSync` decompresses a deflated ZIP entry directly, so reading
* one needs ~100 lines rather than a fifth runtime dependency (AC-2).
*
* Two deliberate choices, both probed against real archives before adopting:
*
* 1. **Sizes come from the central directory, never the local header.** A writer
* that streams uses a data descriptor (general-purpose bit 3) and writes
* zeroes for the compressed size in the *local* header. The central directory
* is always authoritative.
* 2. **No XML parser is constructed.** Tags are stripped textually, so XXE and
* entity-expansion have no surface here at all (design NFR-3). Unknown markup
* degrades to its text content rather than leaking angle brackets (risk R1).
*
* Requirements: project-constitution/AC-3, project-constitution/AC-5
*
* @module
*/
/** The only part of a `.docx` this reader wants. */
export declare const DOCX_MAIN_PART = "word/document.xml";
/** A ZIP this reader cannot make sense of, or one whose entry exceeds the cap. */
export declare class ZipReadError extends Error {
readonly code: 'not-a-zip' | 'malformed' | 'entry-too-large' | 'unsupported-method';
constructor(message: string, code: 'not-a-zip' | 'malformed' | 'entry-too-large' | 'unsupported-method');
}
/**
* Read one entry out of a ZIP archive by exact name.
*
* @param buf - The whole archive.
* @param name - Entry name, matched exactly (`word/document.xml`).
* @param maxInflated - Refuse any entry declaring or producing more than this
* many bytes, so a malicious archive cannot exhaust memory (AC-5).
* @returns The entry's bytes, or `null` when the archive has no such entry.
* @throws ZipReadError when the archive is not readable as a ZIP.
*/
export declare function readZipEntry(buf: Buffer, name: string, maxInflated: number): Buffer | null;
/**
* Convert WordprocessingML to plain text.
*
* `` ends a paragraph, `` and `` are line breaks, ``
* is a tab. Every other tag is dropped and its text content kept, which is what
* makes unknown markup (tables, revision marks, smart tags) degrade safely.
*
* Entity decoding runs with `&` LAST — decoding it first would turn a
* literal `<` into `<` (AC-3, design D3).
*/
export declare function docxToText(xml: string): string;
//# sourceMappingURL=docx.d.ts.map