Skip to main content
Module

x/docxml/src/classes/ZipArchive.ts>ZipArchive

An experimental Deno tool to transform XML to DOCX with a little XPath- and component based configuration
Go to Latest
class ZipArchive
import { ZipArchive } from "https://deno.land/x/docxml@2.1.0/src/classes/ZipArchive.ts";

Constructors

new
ZipArchive(zip?: JSZip)

Properties

private
readonly
promisedBinaryFiles: { location: string; promise: Promise<Uint8Array>; }[]
readonly
optional
location: string
readonly
deprecated
zip: JSZip

Methods

addBinaryFile(location: string, promised: Promise<Uint8Array>): 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 ZipArchive#toUint8Array).

addJsonFile(location: string, js: any): this

Create a new JSON file in the DOCX archive.

addTextFile(location: string, contents: string): this

Create a new text file in the DOCX archive.

addXmlFile(location: string, node: Node | Document): this

Create a new XML file in the DOCX archive.

asUint8Array(): Promise<Uint8Array>
readBinary(location: string): Promise<Uint8Array>
readText(location: string): Promise<string>
readXml(location: string): Promise<Document>
toFile(location: string): Promise<void>

Static Methods

fromFile(location: string): Promise<ZipArchive>