/** * ODF package handler (parallel to docx-core's `DocxArchive`). * * ODF is a ZIP-of-XML like DOCX, but with one sharp packaging rule that DOCX does * not have: the `mimetype` entry MUST be the FIRST entry in the archive and stored * UNCOMPRESSED (STORE, not DEFLATE). Strict ODF readers reject a package that * violates this. * * CRITICAL (verified against JSZip 3.10.1): a fresh JSZip honors mimetype-first + * `{ compression: 'STORE' }`, but if you LOAD an existing `.odt` and re-`generateAsync` * the loaded handle, JSZip re-emits the existing `mimetype` entry as DEFLATE * (method 8) — producing an invalid `.odt`. The ONLY reliable fix is to REBUILD a * fresh JSZip on save: write `mimetype` first with STORE, then copy every other * entry's decompressed content. `save()` below does exactly that. Do not "optimize" * it back into re-saving the loaded handle. */ /** Parts accepted by {@link OdfArchive.create}. `content.xml` is the only required one. */ export interface OdfArchiveCreateParts { contentXml: string; stylesXml?: string; metaXml?: string; } export declare class OdfArchive { private zip; private modified; private constructor(); /** * Load an ODF package from a Buffer. Rejects a buffer that is missing the * required `content.xml` or `META-INF/manifest.xml` parts. */ static load(buffer: Buffer): Promise; /** * Create a fresh ODT package from XML parts. * * `META-INF/manifest.xml` is generated from the provided parts, and the * mimetype-first + STORE discipline is `save()`'s responsibility (the fresh * JSZip here is rebuilt on save like any loaded archive). The result satisfies * `load()`'s content/manifest requirements, so `create(...)` → `save()` → * `load(...)` round-trips. */ static create(parts: OdfArchiveCreateParts): OdfArchive; /** Get `content.xml` as a string. */ getContentXml(): Promise; /** Replace `content.xml`. */ setContentXml(xml: string): void; /** Get an arbitrary part as a string, or null if absent. */ getFile(path: string): Promise; /** Set an arbitrary part. */ setFile(path: string, content: string): void; /** Whether a part exists. */ hasFile(path: string): boolean; /** List all non-directory entry names in the archive. */ listFiles(): string[]; /** Paths modified since load. */ getModifiedPaths(): string[]; /** * Save the archive to a Buffer. * * Rebuilds a fresh JSZip so the `mimetype` entry is guaranteed first + STORE * across a load→modify→save round trip (see the class-level note). Untouched * entries keep byte-identical DECOMPRESSED content; the compressed container * bytes may differ (re-deflation), which matches the DOCX side's guarantee. */ save(): Promise; } //# sourceMappingURL=OdfArchive.d.ts.map