API reference

Low-level (XML / ZIP / schema / packaging)

XML reader / writer, OPC packaging, schema, ZIP. Reach in only when wiring custom parts.

150 exports · 16 source files

Namespaces

src/xml/namespaces.ts

# parseQName function

src/xml/namespaces.ts:172

Inverse of qname. Returns `{ ns, local }`. For unprefixed names `ns` is the empty string.

function parseQName(name: string): { local: string; ns: string }

Parameters

NameTypeDescription
name string

Returns

{ local: string; ns: string }

# qname function

src/xml/namespaces.ts:162

Build a Clark-notation QName: `{namespace}localname`. When `namespace` is empty / undefined the local name is returned as-is.

function qname(namespace: string | undefined, local: string): string

Parameters

NameTypeDescription
namespace string | undefined
local string

Returns

string

# ACTIVEX_TYPE const

src/xml/namespaces.ts:153
const ACTIVEX_TYPE: "application/vnd.ms-office.activeX+xml"

# ARC_APP const

src/xml/namespaces.ts:121
const ARC_APP: "docProps/app.xml"

# ARC_CONTENT_TYPES const

src/xml/namespaces.ts:117
const ARC_CONTENT_TYPES: "[Content_Types].xml"

# ARC_CORE const

src/xml/namespaces.ts:120
const ARC_CORE: "docProps/core.xml"

# ARC_CUSTOM const

src/xml/namespaces.ts:122
const ARC_CUSTOM: "docProps/custom.xml"

# ARC_CUSTOM_UI const

src/xml/namespaces.ts:127
const ARC_CUSTOM_UI: "customUI/customUI.xml"

# ARC_ROOT_RELS const

src/xml/namespaces.ts:118
const ARC_ROOT_RELS: "_rels/.rels"

# ARC_SHARED_STRINGS const

src/xml/namespaces.ts:126
const ARC_SHARED_STRINGS: "xl/sharedStrings.xml"

# ARC_STYLE const

src/xml/namespaces.ts:124
const ARC_STYLE: "xl/styles.xml"

# ARC_THEME const

src/xml/namespaces.ts:125
const ARC_THEME: "xl/theme/theme1.xml"

# ARC_WORKBOOK const

src/xml/namespaces.ts:123
const ARC_WORKBOOK: "xl/workbook.xml"

# ARC_WORKBOOK_RELS const

src/xml/namespaces.ts:119
const ARC_WORKBOOK_RELS: "xl/_rels/workbook.xml.rels"

# C14_NS const

src/xml/namespaces.ts:54
const C14_NS: "http://schemas.microsoft.com/office/drawing/2010/chart"

# C15_NS const

src/xml/namespaces.ts:55
const C15_NS: "http://schemas.microsoft.com/office/drawing/2012/chart"

# C16_NS const

src/xml/namespaces.ts:56
const C16_NS: "http://schemas.microsoft.com/office/drawing/2017/03/chart"

# CHART_DRAWING_NS const

src/xml/namespaces.ts:44
const CHART_DRAWING_NS: "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"

# CHART_NS const

src/xml/namespaces.ts:41
const CHART_NS: "http://schemas.openxmlformats.org/drawingml/2006/chart"

# CHART_TYPE const

src/xml/namespaces.ts:147
const CHART_TYPE: "application/vnd.openxmlformats-officedocument.drawingml.chart+xml"

# CHARTSHAPE_TYPE const

src/xml/namespaces.ts:149
const CHARTSHAPE_TYPE: "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml"

# CHARTSHEET_TYPE const

src/xml/namespaces.ts:145
const CHARTSHEET_TYPE: string

# COMMENTS_NS const

src/xml/namespaces.ts:22
const COMMENTS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"

# COMMENTS_TYPE const

src/xml/namespaces.ts:143
const COMMENTS_TYPE: string

# CONTYPES_NS const

src/xml/namespaces.ts:36
const CONTYPES_NS: "http://schemas.openxmlformats.org/package/2006/content-types"

# COREPROPS_NS const

src/xml/namespaces.ts:35
const COREPROPS_NS: "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"

# CPROPS_FMTID const

src/xml/namespaces.ts:29
const CPROPS_FMTID: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"

# CPROPS_TYPE const

src/xml/namespaces.ts:151
const CPROPS_TYPE: "application/vnd.openxmlformats-officedocument.custom-properties+xml"

# CTRLPROPS_TYPE const

src/xml/namespaces.ts:154
const CTRLPROPS_TYPE: "application/vnd.ms-excel.controlproperties+xml"

# CUSTOMUI_NS const

src/xml/namespaces.ts:49
const CUSTOMUI_NS: "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility"

# CUSTPROPS_NS const

src/xml/namespaces.ts:28
const CUSTPROPS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"

# CX_NS const

src/xml/namespaces.ts:57
const CX_NS: "http://schemas.microsoft.com/office/drawing/2014/chartex"

# DCMITYPE_NS const

src/xml/namespaces.ts:15
const DCMITYPE_NS: "http://purl.org/dc/dcmitype/"

# DCORE_NS const

src/xml/namespaces.ts:13
const DCORE_NS: "http://purl.org/dc/elements/1.1/"

# DCTERMS_NS const

src/xml/namespaces.ts:14
const DCTERMS_NS: "http://purl.org/dc/terms/"

# DCTERMS_PREFIX const

src/xml/namespaces.ts:16
const DCTERMS_PREFIX: "dcterms"

# DEFAULT_PREFIXES const

src/xml/namespaces.ts:68
const DEFAULT_PREFIXES: Readonly<Record<string, string>>

# DRAWING_NS const

src/xml/namespaces.ts:42
const DRAWING_NS: "http://schemas.openxmlformats.org/drawingml/2006/main"

# DRAWING_TYPE const

src/xml/namespaces.ts:146
const DRAWING_TYPE: "application/vnd.openxmlformats-officedocument.drawing+xml"

# IMAGE_NS const

src/xml/namespaces.ts:23
const IMAGE_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"

# MARKUP_COMPAT_NS const

src/xml/namespaces.ts:50
const MARKUP_COMPAT_NS: "http://schemas.openxmlformats.org/markup-compatibility/2006"

# PACKAGE_CHARTS const

src/xml/namespaces.ts:110
const PACKAGE_CHARTS: "xl/charts"

# PACKAGE_CHARTSHEETS const

src/xml/namespaces.ts:108
const PACKAGE_CHARTSHEETS: "xl/chartsheets"

# PACKAGE_CHARTSHEETS_RELS const

src/xml/namespaces.ts:115
const PACKAGE_CHARTSHEETS_RELS: "xl/chartsheets/_rels"

# PACKAGE_DRAWINGS const

src/xml/namespaces.ts:109
const PACKAGE_DRAWINGS: "xl/drawings"

# PACKAGE_IMAGES const

src/xml/namespaces.ts:111
const PACKAGE_IMAGES: "xl/media"

# PACKAGE_PIVOT_CACHE const

src/xml/namespaces.ts:113
const PACKAGE_PIVOT_CACHE: "xl/pivotCache"

# PACKAGE_PIVOT_TABLE const

src/xml/namespaces.ts:112
const PACKAGE_PIVOT_TABLE: "xl/pivotTables"

# PACKAGE_PROPS const

src/xml/namespaces.ts:103
const PACKAGE_PROPS: "docProps"

# PACKAGE_RELS const

src/xml/namespaces.ts:105
const PACKAGE_RELS: "_rels"

# PACKAGE_THEME const

src/xml/namespaces.ts:106
const PACKAGE_THEME: "xl/theme"

# PACKAGE_WORKSHEET_RELS const

src/xml/namespaces.ts:114
const PACKAGE_WORKSHEET_RELS: "xl/worksheets/_rels"

# PACKAGE_WORKSHEETS const

src/xml/namespaces.ts:107
const PACKAGE_WORKSHEETS: "xl/worksheets"

# PACKAGE_XL const

src/xml/namespaces.ts:104
const PACKAGE_XL: "xl"

# PICTURE_NS const

src/xml/namespaces.ts:45
const PICTURE_NS: "http://schemas.openxmlformats.org/drawingml/2006/picture"

# PKG_REL_NS const

src/xml/namespaces.ts:34
const PKG_REL_NS: "http://schemas.openxmlformats.org/package/2006/relationships"

# REL_NS const

src/xml/namespaces.ts:21
const REL_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"

# SHARED_STRINGS_TYPE const

src/xml/namespaces.ts:140
const SHARED_STRINGS_TYPE: string

# SHEET_DRAWING_NS const

src/xml/namespaces.ts:43
const SHEET_DRAWING_NS: "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"

# SHEET_MAIN_NS const

src/xml/namespaces.ts:40
const SHEET_MAIN_NS: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"

# STYLES_TYPE const

src/xml/namespaces.ts:144
const STYLES_TYPE: string

# THEME_TYPE const

src/xml/namespaces.ts:150
const THEME_TYPE: "application/vnd.openxmlformats-officedocument.theme+xml"

# THREADED_COMMENTS_NS const

src/xml/namespaces.ts:58
const THREADED_COMMENTS_NS: "http://schemas.microsoft.com/office/spreadsheetml/2018/threadedcomments"

# VBA_TYPE const

src/xml/namespaces.ts:152
const VBA_TYPE: "application/vnd.ms-office.vbaProject"

# VML_NS const

src/xml/namespaces.ts:24
const VML_NS: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"

# VTYPES_NS const

src/xml/namespaces.ts:26
const VTYPES_NS: "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"

# WORKSHEET_TYPE const

src/xml/namespaces.ts:142
const WORKSHEET_TYPE: string

# X14_NS const

src/xml/namespaces.ts:51
const X14_NS: "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"

# X15_NS const

src/xml/namespaces.ts:52
const X15_NS: "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"

# X16_NS const

src/xml/namespaces.ts:53
const X16_NS: "http://schemas.microsoft.com/office/spreadsheetml/2014/revision"

# XLSM_TYPE const

src/xml/namespaces.ts:138
const XLSM_TYPE: string

# XLSX_TYPE const

src/xml/namespaces.ts:136
const XLSX_TYPE: string

# XLTM_TYPE const

src/xml/namespaces.ts:139
const XLTM_TYPE: string

# XLTX_TYPE const

src/xml/namespaces.ts:137
const XLTX_TYPE: string

# XML_NS const

src/xml/namespaces.ts:10
const XML_NS: "http://www.w3.org/XML/1998/namespace"

# XPROPS_NS const

src/xml/namespaces.ts:27
const XPROPS_NS: "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"

# XSI_NS const

src/xml/namespaces.ts:11
const XSI_NS: "http://www.w3.org/2001/XMLSchema-instance"

Custom

src/packaging/custom.ts

# appendCustomProperty function

src/packaging/custom.ts:122
function appendCustomProperty(props: CustomProperties, name: string, value: XmlNode, opts?: { fmtid?: string; pid?: number }): CustomProperty

Parameters

NameTypeDescription
props CustomProperties
name string
value XmlNode
opts? { fmtid?: string; pid?: number }

Returns

CustomProperty

# customPropsFromBytes function

src/packaging/custom.ts:156
function customPropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): CustomProperties

Parameters

NameTypeDescription
bytes string | Uint8Array<ArrayBufferLike>

Returns

CustomProperties

# customPropsToBytes function

src/packaging/custom.ts:142
function customPropsToBytes(p: CustomProperties): Uint8Array

Parameters

NameTypeDescription
p CustomProperties

Returns

Uint8Array

# findCustomPropertyByName function

src/packaging/custom.ts:135
function findCustomPropertyByName(props: CustomProperties, name: string): CustomProperty | undefined

Parameters

NameTypeDescription
props CustomProperties
name string

Returns

CustomProperty | undefined

# getCustomPropertyValue function

src/packaging/custom.ts:249

Read the typed value of a custom property by name. Tries each decoder in turn — string, int, double, bool, filetime — and returns the first hit. Returns `undefined` for unknown names or unsupported types.

function getCustomPropertyValue(wb: Workbook, name: string): string | number | boolean | undefined

Parameters

NameTypeDescription
wb Workbook
name string

Returns

string | number | boolean | undefined

# listCustomProperties function

src/packaging/custom.ts:283

Read-only snapshot of every custom property.

function listCustomProperties(wb: Workbook): readonly CustomProperty[]

Parameters

NameTypeDescription
wb Workbook

Returns

readonly CustomProperty[]

# makeAsciiStringValue function

src/packaging/custom.ts:44
function makeAsciiStringValue(s: string): XmlNode

Parameters

NameTypeDescription
s string

Returns

XmlNode

# makeBoolValue function

src/packaging/custom.ts:55
function makeBoolValue(b: boolean): XmlNode

Parameters

NameTypeDescription
b boolean

Returns

XmlNode

# makeCustomProperties function

src/packaging/custom.ts:30
function makeCustomProperties(): CustomProperties

Returns

CustomProperties

# makeDateValue function

src/packaging/custom.ts:61
function makeDateValue(iso: string): XmlNode

Parameters

NameTypeDescription
iso string

Returns

XmlNode

# makeDoubleValue function

src/packaging/custom.ts:51
function makeDoubleValue(n: number): XmlNode

Parameters

NameTypeDescription
n number

Returns

XmlNode

# makeFiletimeValue function

src/packaging/custom.ts:58
function makeFiletimeValue(iso: string): XmlNode

Parameters

NameTypeDescription
iso string

Returns

XmlNode

# makeIntValue function

src/packaging/custom.ts:47
function makeIntValue(n: number): XmlNode

Parameters

NameTypeDescription
n number

Returns

XmlNode

# makeStringValue function

src/packaging/custom.ts:41
function makeStringValue(s: string): XmlNode

Parameters

NameTypeDescription
s string

Returns

XmlNode

# readBoolValue function

src/packaging/custom.ts:99
function readBoolValue(v: XmlNode): boolean | undefined

Parameters

NameTypeDescription
v XmlNode

Returns

boolean | undefined

# readDoubleValue function

src/packaging/custom.ts:91
function readDoubleValue(v: XmlNode): number | undefined

Parameters

NameTypeDescription
v XmlNode

Returns

number | undefined

# readFiletimeValue function

src/packaging/custom.ts:106
function readFiletimeValue(v: XmlNode): string | undefined

Parameters

NameTypeDescription
v XmlNode

Returns

string | undefined

# readIntValue function

src/packaging/custom.ts:74
function readIntValue(v: XmlNode): number | undefined

Parameters

NameTypeDescription
v XmlNode

Returns

number | undefined

# readStringValue function

src/packaging/custom.ts:69
function readStringValue(v: XmlNode): string | undefined

Parameters

NameTypeDescription
v XmlNode

Returns

string | undefined

# removeCustomProperty function

src/packaging/custom.ts:273

Remove a custom property by name. Returns `true` when one was removed, `false` when the name wasn't found.

function removeCustomProperty(wb: Workbook, name: string): boolean

Parameters

NameTypeDescription
wb Workbook
name string

Returns

boolean

# setCustomBoolProperty function

src/packaging/custom.ts:228

Set (or replace) a custom boolean property.

function setCustomBoolProperty(wb: Workbook, name: string, value: boolean): CustomProperty

Parameters

NameTypeDescription
wb Workbook
name string
value boolean

Returns

CustomProperty

# setCustomDateProperty function

src/packaging/custom.ts:235

Set (or replace) a custom date property. Accepts a `Date` (converted to ISO via `toISOString()`) or a pre-formatted W3C-DTF string.

function setCustomDateProperty(wb: Workbook, name: string, value: string | Date): CustomProperty

Parameters

NameTypeDescription
wb Workbook
name string
value string | Date

Returns

CustomProperty

# setCustomNumberProperty function

src/packaging/custom.ts:218

Set (or replace) a custom numeric property. Integers (within Int32 range) are stored as `vt:i4`; non-integer / out-of-range numbers as `vt:r8` doubles.

function setCustomNumberProperty(wb: Workbook, name: string, value: number): CustomProperty

Parameters

NameTypeDescription
wb Workbook
name string
value number

Returns

CustomProperty

# setCustomStringProperty function

src/packaging/custom.ts:211

Set (or replace) a custom string property.

function setCustomStringProperty(wb: Workbook, name: string, value: string): CustomProperty

Parameters

NameTypeDescription
wb Workbook
name string
value string

Returns

CustomProperty

Core

src/packaging/core.ts

# corePropsFromBytes function

src/packaging/core.ts:99
function corePropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): CoreProperties

Parameters

NameTypeDescription
bytes string | Uint8Array<ArrayBufferLike>

Returns

CoreProperties

# corePropsToBytes function

src/packaging/core.ts:95
function corePropsToBytes(p: CoreProperties): Uint8Array

Parameters

NameTypeDescription
p CoreProperties

Returns

Uint8Array

# makeCoreProperties function

src/packaging/core.ts:91
function makeCoreProperties(): CoreProperties

Returns

CoreProperties

# setWorkbookCategory function

src/packaging/core.ts:143

Set the document category (e.g. "Reports", "Drafts").

function setWorkbookCategory(wb: Workbook, category: string): void

Parameters

NameTypeDescription
wb Workbook
category string

Returns

void

# setWorkbookCreator function

src/packaging/core.ts:113

Set the document author (Excel "File → Properties → Author").

function setWorkbookCreator(wb: Workbook, creator: string): void

Parameters

NameTypeDescription
wb Workbook
creator string

Returns

void

# setWorkbookDescription function

src/packaging/core.ts:128

Set the document description / abstract.

function setWorkbookDescription(wb: Workbook, description: string): void

Parameters

NameTypeDescription
wb Workbook
description string

Returns

void

# setWorkbookKeywords function

src/packaging/core.ts:133

Set comma- or semicolon-separated keywords.

function setWorkbookKeywords(wb: Workbook, keywords: string): void

Parameters

NameTypeDescription
wb Workbook
keywords string

Returns

void

# setWorkbookLastModifiedBy function

src/packaging/core.ts:138

Set the "last modified by" name (defaults to creator if absent).

function setWorkbookLastModifiedBy(wb: Workbook, name: string): void

Parameters

NameTypeDescription
wb Workbook
name string

Returns

void

# setWorkbookSubject function

src/packaging/core.ts:123

Set the document subject.

function setWorkbookSubject(wb: Workbook, subject: string): void

Parameters

NameTypeDescription
wb Workbook
subject string

Returns

void

# setWorkbookTitle function

src/packaging/core.ts:118

Set the document title.

function setWorkbookTitle(wb: Workbook, title: string): void

Parameters

NameTypeDescription
wb Workbook
title string

Returns

void

Extended

src/packaging/extended.ts

# extendedPropsFromBytes function

src/packaging/extended.ts:120
function extendedPropsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): ExtendedProperties

Parameters

NameTypeDescription
bytes string | Uint8Array<ArrayBufferLike>

Returns

ExtendedProperties

# extendedPropsToBytes function

src/packaging/extended.ts:116
function extendedPropsToBytes(p: ExtendedProperties): Uint8Array

Parameters

NameTypeDescription
p ExtendedProperties

Returns

Uint8Array

# makeExtendedProperties function

src/packaging/extended.ts:112
function makeExtendedProperties(): ExtendedProperties

Returns

ExtendedProperties

# setWorkbookApplication function

src/packaging/extended.ts:144

Set the application name (e.g. `"Microsoft Excel"`).

function setWorkbookApplication(wb: Workbook, application: string): void

Parameters

NameTypeDescription
wb Workbook
application string

Returns

void

# setWorkbookAppVersion function

src/packaging/extended.ts:149

Set the application version (typically `"16.0300"` for Excel 365).

function setWorkbookAppVersion(wb: Workbook, version: string): void

Parameters

NameTypeDescription
wb Workbook
version string

Returns

void

# setWorkbookCompany function

src/packaging/extended.ts:134

Set the company name on docProps/app.xml.

function setWorkbookCompany(wb: Workbook, company: string): void

Parameters

NameTypeDescription
wb Workbook
company string

Returns

void

# setWorkbookHyperlinkBase function

src/packaging/extended.ts:154

Set the hyperlink base URL — Excel uses this as a prefix for relative `&F` codes.

function setWorkbookHyperlinkBase(wb: Workbook, base: string): void

Parameters

NameTypeDescription
wb Workbook
base string

Returns

void

# setWorkbookManager function

src/packaging/extended.ts:139

Set the manager / supervisor name on docProps/app.xml.

function setWorkbookManager(wb: Workbook, manager: string): void

Parameters

NameTypeDescription
wb Workbook
manager string

Returns

void

Manifest

src/packaging/manifest.ts

# addDefault function

src/packaging/manifest.ts:74

Register a default content type for an extension. Idempotent.

function addDefault(m: Manifest, ext: string, contentType: string): void

Parameters

NameTypeDescription
m Manifest
ext string
contentType string

Returns

void

# addOverride function

src/packaging/manifest.ts:87

Register an Override for a specific part. Idempotent.

function addOverride(m: Manifest, partName: string, contentType: string): void

Parameters

NameTypeDescription
m Manifest
partName string
contentType string

Returns

void

# findOverride function

src/packaging/manifest.ts:97
function findOverride(m: Manifest, partName: string): OverrideEntry | undefined

Parameters

NameTypeDescription
m Manifest
partName string

Returns

OverrideEntry | undefined

# findOverrideByContentType function

src/packaging/manifest.ts:103

Find the first Override matching a content type.

function findOverrideByContentType(m: Manifest, contentType: string): OverrideEntry | undefined

Parameters

NameTypeDescription
m Manifest
contentType string

Returns

OverrideEntry | undefined

# makeManifest function

src/packaging/manifest.ts:69
function makeManifest(): Manifest

Returns

Manifest

# manifestFromBytes function

src/packaging/manifest.ts:112
function manifestFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): Manifest

Parameters

NameTypeDescription
bytes string | Uint8Array<ArrayBufferLike>

Returns

Manifest

# manifestToBytes function

src/packaging/manifest.ts:108
function manifestToBytes(m: Manifest): Uint8Array

Parameters

NameTypeDescription
m Manifest

Returns

Uint8Array

Relationships

src/packaging/relationships.ts

# appendRel function

src/packaging/relationships.ts:86

Append a relationship and return the resulting object. Auto-assigns the next free `rId{N}` Id.

function appendRel(rels: Relationships, type: string, target: string, targetMode?: "External"): Relationship

Parameters

NameTypeDescription
rels Relationships
type string
target string
targetMode? "External"

Returns

Relationship

# findAllByType function

src/packaging/relationships.ts:114
function findAllByType(rels: Relationships, type: string): Relationship[]

Parameters

NameTypeDescription
rels Relationships
type string

Returns

Relationship[]

# findById function

src/packaging/relationships.ts:93
function findById(rels: Relationships, id: string): Relationship | undefined

Parameters

NameTypeDescription
rels Relationships
id string

Returns

Relationship | undefined

# findByType function

src/packaging/relationships.ts:109
function findByType(rels: Relationships, type: string): Relationship | undefined

Parameters

NameTypeDescription
rels Relationships
type string

Returns

Relationship | undefined

# makeRelationships function

src/packaging/relationships.ts:60
function makeRelationships(): Relationships

Returns

Relationships

# relsFromBytes function

src/packaging/relationships.ts:124
function relsFromBytes(bytes: string | Uint8Array<ArrayBufferLike>): Relationships

Parameters

NameTypeDescription
bytes string | Uint8Array<ArrayBufferLike>

Returns

Relationships

# relsToBytes function

src/packaging/relationships.ts:120
function relsToBytes(rels: Relationships): Uint8Array

Parameters

NameTypeDescription
rels Relationships

Returns

Uint8Array

Tree

src/xml/tree.ts

# appendChild function

src/xml/tree.ts:89

Append `child` to `parent`. Mutates and returns `parent` for chaining during construction. Avoid in hot paths — for cell writing the worksheet writer goes through a templated emitter rather than building XmlNode trees per cell.

function appendChild(parent: XmlNode, child: XmlNode): XmlNode

Parameters

NameTypeDescription
parent XmlNode
child XmlNode

Returns

XmlNode

# el function

src/xml/tree.ts:31

Build an XmlNode from primitive bits. Attributes / children default to empty; pass `undefined` for `text` to omit the text node. The element's name is always supplied in Clark notation. Use the qname helper from `./namespaces` to keep call sites readable.

function el(name: string, attrs?: Readonly<Record<string, string | number | boolean | null | undefined>>, children?: readonly XmlNode[], text?: string): XmlNode

Parameters

NameTypeDescription
name string
attrs? = {}Readonly<Record<string, string | number | boolean | null | undefined>>
children? = []readonly XmlNode[]
text? string

Returns

XmlNode

# elNs function

src/xml/tree.ts:61

Convenience: element with a Clark-notation name composed from a namespace URI and local name.

function elNs(namespace: string | undefined, local: string, attrs?: Readonly<Record<string, string | number | boolean | null | undefined>>, children?: readonly XmlNode[], text?: string): XmlNode

Parameters

NameTypeDescription
namespace string | undefined
local string
attrs? Readonly<Record<string, string | number | boolean | null | undefined>>
children? readonly XmlNode[]
text? string

Returns

XmlNode

# findChild function

src/xml/tree.ts:72

Locate the first child matching the supplied Clark-notation name.

function findChild(node: XmlNode, name: string): XmlNode | undefined

Parameters

NameTypeDescription
node XmlNode
name string

Returns

XmlNode | undefined

# findChildren function

src/xml/tree.ts:78

All children matching the supplied Clark-notation name, in document order.

function findChildren(node: XmlNode, name: string): XmlNode[]

Parameters

NameTypeDescription
node XmlNode
name string

Returns

XmlNode[]

Serialize

src/schema/serialize.ts

# fromTree function

src/schema/serialize.ts:203

Materialise a value of `T` from an XmlNode per the supplied schema.

function fromTree(node: XmlNode, schema: Schema<T>): T

Parameters

NameTypeDescription
node XmlNode
schema Schema<T>

Returns

T

# toTree function

src/schema/serialize.ts:90

Serialise a value of `T` into an XmlNode per the supplied schema.

function toTree(value: T, schema: Schema<T>): XmlNode

Parameters

NameTypeDescription
value T
schema Schema<T>

Returns

XmlNode

Core

src/schema/core.ts

# defineSchema function

src/schema/core.ts:154

Identity helper that pins inference to the supplied `T`. The runtime is just `s => s`; the value matters only for the call-site type.

function defineSchema(s: Schema<T>): Schema<T>

Parameters

NameTypeDescription
s Schema<T>

Returns

Schema<T>

Decompression guard

src/zip/decompression-guard.ts

# DEFAULT_DECOMPRESSION_LIMITS const

src/zip/decompression-guard.ts:53

Default safeguards applied when the caller doesn't override them.

const DEFAULT_DECOMPRESSION_LIMITS: ResolvedDecompressionLimits

Iterparse

src/xml/iterparse.ts

# iterParse function

src/xml/iterparse.ts:83

Parse the input as a stream of SAX events. Element / attribute names are returned in Clark notation (`{ns}local`).

function iterParse(input: SaxInput): AsyncIterableIterator<SaxEvent>

Parameters

NameTypeDescription
input SaxInput

Returns

AsyncIterableIterator<SaxEvent>

Parser

src/xml/parser.ts

# parseXml function

src/xml/parser.ts:72

Parse a UTF-8 XML payload into an XmlNode tree. Element and attribute names are returned in Clark notation. Throws OpenXmlSchemaError on DTD/entity declarations or on multi-root documents.

function parseXml(input: string | Uint8Array<ArrayBufferLike>): XmlNode

Parameters

NameTypeDescription
input string | Uint8Array<ArrayBufferLike>

Returns

XmlNode

Reader

src/zip/reader.ts

# openZip function

src/zip/reader.ts:69

Open a zip archive from any XlsxSource. The source is fully materialised in memory, the central directory is parsed once, and each entry is inflated on demand by openRandomAccessArchive — peak memory stays at compressed-archive size plus per-entry inflate scratch rather than holding every uncompressed entry resident. The fflate `unzipSync` fallback is preserved internally for ZIP64 / non-standard archives the random-access reader rejects.

function openZip(source: XlsxSource, opts?: OpenZipOptions): Promise<ZipArchive>

Parameters

NameTypeDescription
source XlsxSource
opts? = {}OpenZipOptions

Returns

Promise<ZipArchive>

Serializer

src/xml/serializer.ts

# serializeXml function

src/xml/serializer.ts:37

Serialize an XmlNode tree into a UTF-8 byte payload. The inverse of parseXml: `parseXml(serializeXml(n))` yields a tree structurally equivalent to `n` modulo attribute insertion order (which both directions preserve on Node 18+ / V8).

function serializeXml(root: XmlNode, opts?: SerializeOptions): Uint8Array

Parameters

NameTypeDescription
root XmlNode
opts? = {}SerializeOptions

Returns

Uint8Array

Stream writer

src/xml/stream-writer.ts

# createXmlStreamWriter function

src/xml/stream-writer.ts:73
function createXmlStreamWriter(opts?: XmlStreamWriterOptions): XmlStreamWriter

Parameters

NameTypeDescription
opts? = {}XmlStreamWriterOptions

Returns

XmlStreamWriter

Writer

src/zip/writer.ts

# createZipWriter function

src/zip/writer.ts:93

ZIP writer backed by fflate's streaming `Zip` class. Entries are pushed through `ZipDeflate` / `ZipPassThrough` streams as they arrive, so peak memory stays at the size of the in-flight entry plus the output buffer rather than the full archive. The sink contract is `toBytes()`, but that name is historical: the sink is driven by a chunked `write(chunk)` API that fans bytes out as they arrive. The buffered Node/browser sinks (`toBuffer`, `toBlob`, `toArrayBuffer`) concatenate the chunks for a single-shot result; streaming sinks (`toFile`, `toWritable`) forward each chunk to disk / the wrapped writable without ever holding the full archive resident. Either kind plugs in here.

function createZipWriter(sink: XlsxSink): ZipWriter

Parameters

NameTypeDescription
sink XlsxSink

Returns

ZipWriter