Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

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

TypeScript (component) library for building and parsing a DOCX file
Go to Latest
class BinaryFile
import { BinaryFile } from "https://deno.land/x/docxml@5.13.2/src/classes/BinaryFile.ts";

A utility class that represents a binary file inside the DOCX archive -- currently used for images.

Constructors

new
protected
BinaryFile(
location: string,
reader: BinaryFileReader,
mime: FileMime,
)

Properties

readonly
contentType: Promise<FileMime>
readonly
location: string
mime: FileMime

Methods

addToArchive(archive: Archive): void

Add all related files to the given archive.

Get all XmlFile instances related to this one, including self. This helps the system serialize itself back to DOCX fullly. Probably not useful for consumers of the library.

By default only returns the instance itself but no other related instances.

Let a file tell the system when it is effectively empty, so it can be omitted from the archive.

toUint8Array(): Promise<Uint8Array>

Static Methods

fromArchive(
archive: Archive,
contentTypes: ContentTypesXml,
location: string,
): BinaryFile
fromData(
data: Uint8Array | Promise<Uint8Array>,
location: string,
mime: FileMime,
): BinaryFile
fromDisk(
diskLocation: string,
location: string,
mime: FileMime,
): BinaryFile