/** * DOCX Module - CFB (Compound File Binary) Reader * * Minimal reader for OLE2/CFB format used by encrypted Office documents. * Implements enough of MS-CFB to extract named streams (EncryptionInfo, EncryptedPackage). * * References: * - MS-CFB: Compound File Binary File Format * - https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb */ /** A stream entry extracted from/written to a CFB file. */ export interface CfbEntry { /** Stream name (UTF-16LE decoded). */ readonly name: string; /** Stream data. */ readonly data: Uint8Array; /** * Optional storage path for the stream. Each element is a storage * (directory) name; the stream lives inside the nested storages. * For example `path: ["\u0006DataSpaces", "TransformInfo"]` with * `name: "..."` places the stream at * `\u0006DataSpaces/TransformInfo/`. Omit or use `[]` for a * top-level stream under the root storage. */ readonly path?: readonly string[]; } /** * Read a CFB (OLE2 Compound File) and extract all stream entries. * * Only reads v3 and v4 CFB files (sector sizes 512 and 4096). * * @param buffer - The CFB file data. * @returns Array of named stream entries. */ export declare function readCfb(buffer: Uint8Array): CfbEntry[]; /** * Write a set of named stream entries into a CFB (OLE2 Compound File) container. * * Produces a v3 CFB with 512-byte sectors. Streams smaller than 4096 bytes are * stored in the mini-stream (64-byte mini-sectors) exactly as Office does; * larger streams use regular sectors. Entries may declare a `path` to nest the * stream inside one or more storages — required for the `\u0006DataSpaces` * structure that Office demands in encrypted documents. * * @param entries - Named stream entries to include. * @returns The CFB file as a Uint8Array. */ export declare function writeCfb(entries: readonly CfbEntry[]): Uint8Array;