UNPKG

docxml

Version:

TypeScript (component) library for building and parsing a DOCX file

41 lines (40 loc) 1.53 kB
import { JSZip } from '../../deps/deno.land/x/jszip@0.11.0/mod.js'; export declare class Archive { #private; readonly location?: string; constructor(zip?: JSZip); /** * @deprecated For testing purposes only. */ get $$$fileNames(): { [key: string]: import("../../deps/deno.land/x/jszip@0.11.0/types.js").JSZipObject; }; hasFile(location: string): boolean; readText(location: string): Promise<string>; asUint8Array(): Promise<Uint8Array>; readXml(location: string): Promise<Document>; readBinary(location: string): Promise<Uint8Array>; /** * Create a new XML file in the DOCX archive. */ addXmlFile(location: string, node: Node | Document): this; /** * Create a new JSON file in the DOCX archive. */ addJsonFile(location: string, js: any): this; /** * Create a new text file in the DOCX archive. */ addTextFile(location: string, contents: string): this; /** * Create a new text file in the DOCX archive. * * In order to keep this method (and methods that use it, eg. Docx#toArchive) synchronous, * we're only writing a promise to memory for now and leave the asynchronous operations for * output time (see also Archive#toUint8Array). */ addBinaryFile(location: string, promised: Promise<Uint8Array>): this; static fromUInt8Array(data: Uint8Array): Promise<Archive>; static fromFile(location: string): Promise<Archive>; toFile(location: string): Promise<void>; }