@storyteller-platform/epub 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/README.md +2577 -0
- package/dist/index.cjs +1838 -0
- package/dist/index.d.cts +714 -0
- package/dist/index.d.ts +714 -0
- package/dist/index.js +1810 -0
- package/dist/node.cjs +66 -0
- package/dist/node.d.cts +28 -0
- package/dist/node.d.ts +28 -0
- package/dist/node.js +42 -0
- package/package.json +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,2577 @@
|
|
|
1
|
+
# @storyteller-platform/epub
|
|
2
|
+
|
|
3
|
+
A Node.js library for inspecting, modifying, and creating EPUB 3 publications.
|
|
4
|
+
|
|
5
|
+
<!-- toc -->
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [About](#about)
|
|
9
|
+
- [EPUB Basics](#epub-basics)
|
|
10
|
+
- [What this library does](#what-this-library-does)
|
|
11
|
+
- [Usage](#usage)
|
|
12
|
+
- [Reading from a file](#reading-from-a-file)
|
|
13
|
+
- [Creating from scratch](#creating-from-scratch)
|
|
14
|
+
- [Adding a chapter](#adding-a-chapter)
|
|
15
|
+
- [Writing to disk](#writing-to-disk)
|
|
16
|
+
- [Writing to a byte array](#writing-to-a-byte-array)
|
|
17
|
+
- [Development](#development)
|
|
18
|
+
- [API Docs](#api-docs)
|
|
19
|
+
|
|
20
|
+
<!-- tocstop -->
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
npm:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm install @storyteller-platform/epub
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
yarn:
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
yarn add @storyteller-platform/epub
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
deno:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
deno install npm:@storyteller-platform/epub
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## About
|
|
43
|
+
|
|
44
|
+
Throughout this library's documentation, there will be many references to
|
|
45
|
+
[the EPUB 3 specification](https://www.w3.org/TR/epub-33/). The lower level APIs
|
|
46
|
+
exposed by this library require some knowledge of this specification. Here we
|
|
47
|
+
will cover the very basics necessary to work with the library, but we recommend
|
|
48
|
+
that users read through the linked specification to gain a deeper understanding
|
|
49
|
+
of the format.
|
|
50
|
+
|
|
51
|
+
### EPUB Basics
|
|
52
|
+
|
|
53
|
+
An EPUB file is a ZIP archive with a partially specified directory and file
|
|
54
|
+
structure. Most of the metadata and content is specified as XML documents, with
|
|
55
|
+
additional resources referenced from those XML documents.
|
|
56
|
+
|
|
57
|
+
The most important of these documents is the
|
|
58
|
+
[package document](https://www.w3.org/TR/epub-33/#sec-package-doc).
|
|
59
|
+
|
|
60
|
+
> The package document is an XML document that consists of a set of elements
|
|
61
|
+
> that each encapsulate information about a particular aspect of an EPUB
|
|
62
|
+
> publication. These elements serve to centralize metadata, detail the
|
|
63
|
+
> individual resources, and provide the reading order and other information
|
|
64
|
+
> necessary for its rendering.
|
|
65
|
+
|
|
66
|
+
This library is primarily concerned with providing access to the metadata,
|
|
67
|
+
manifest, and spine of the EPUB publication. Metadata refers to information
|
|
68
|
+
_about_ the publication, such as its title or authors. The manifest refers to
|
|
69
|
+
the complete set of resources that are used to render the publication, such as
|
|
70
|
+
XHTML documents and image files. And the spine refers to the ordered list of
|
|
71
|
+
manifest items that represent the default reading order — the order that
|
|
72
|
+
readers will encounter the manifest items by simply turning pages one at a time.
|
|
73
|
+
|
|
74
|
+
### What this library does
|
|
75
|
+
|
|
76
|
+
`@storyteller-platform/epub` provides an API to interact with the metadata,
|
|
77
|
+
manifest, and spine of the EPUB publication. There are higher level APIs that
|
|
78
|
+
mostly abstract away the implementation details of the EPUB specification, like
|
|
79
|
+
`epub.setTitle(title: string)` and `epub.getCreators()`, as well as lower level
|
|
80
|
+
APIs like `epub.writeItemContents(path: string, contents: Uint8Array)` and
|
|
81
|
+
`epub.addMetadata(entry: MetadataEntry)`, which require some understanding of
|
|
82
|
+
the EPUB structure to utilize effectively.
|
|
83
|
+
|
|
84
|
+
Because EPUB publications rely heavily on the XML document format, this library
|
|
85
|
+
also provides utility methods for parsing, manipulating, and building XML
|
|
86
|
+
documents. The underlying XML operations are based on
|
|
87
|
+
[fast-xml-parser](https://www.npmjs.com/package/fast-xml-parser).
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
The entrypoint to the library is through the [`Epub`](#epub) class. An `Epub`
|
|
92
|
+
can either be read from an existing EPUB publication file, or created from
|
|
93
|
+
scratch.
|
|
94
|
+
|
|
95
|
+
### Reading from a file
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// If you want to read or write to disk, import from the `/node`
|
|
99
|
+
// export
|
|
100
|
+
import { Epub } from "@storyteller-platform/epub/node"
|
|
101
|
+
|
|
102
|
+
const epub = await Epub.from("path/to/book.epub")
|
|
103
|
+
console.log(await epub.getTitle())
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Creating from scratch
|
|
107
|
+
|
|
108
|
+
When creating an `Epub` from scratch, the `title`, `language`, and `identifier`
|
|
109
|
+
_must_ be provided, as these are required for all publications by the EPUB 3
|
|
110
|
+
specification.
|
|
111
|
+
|
|
112
|
+
Other [Dublin Core](https://www.w3.org/TR/epub-33/#sec-opf-dcmes-hd) and
|
|
113
|
+
non-core metadata may also be provided at creation time, or may be added
|
|
114
|
+
incrementally after creation.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import { randomUUID } from "node:crypto"
|
|
118
|
+
|
|
119
|
+
import { Epub } from "@storyteller-platform/epub"
|
|
120
|
+
|
|
121
|
+
const epub = await Epub.create({
|
|
122
|
+
title: "S'mores For Everyone",
|
|
123
|
+
// This should be the primary language of the publication.
|
|
124
|
+
// Individual content resources may specify their own languages.
|
|
125
|
+
language: new Intl.Locale("en-US"),
|
|
126
|
+
// This can be any unique identifier, including UUIDs, ISBNs, etc
|
|
127
|
+
identifier: randomUUID(),
|
|
128
|
+
})
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Adding a chapter
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
import { Epub, ManifestItem } from "@storyteller-platform/epub"
|
|
135
|
+
|
|
136
|
+
const epub = await Epub.from("path/to/book.epub")
|
|
137
|
+
|
|
138
|
+
// Construct a manifest item describing the chapter
|
|
139
|
+
const manifestItem: ManifestItem = {
|
|
140
|
+
id: "chapter-one",
|
|
141
|
+
// This is the filepath for the chapter contents within the
|
|
142
|
+
// EPUB archive.
|
|
143
|
+
href: "XHTML/chapter-one.xhtml",
|
|
144
|
+
mediaType: "application/xhtml+xml",
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// You can specify the contents as a string
|
|
148
|
+
const contents = `<?xml version="1.0" encoding="UTF-8"?>
|
|
149
|
+
<html xmlns="http://www.w3.org/1999/xhtml"
|
|
150
|
+
xmlns:epub="http://www.idpf.org/2007/ops"
|
|
151
|
+
xml:lang="en-US"
|
|
152
|
+
lang="en-US">
|
|
153
|
+
<head></head>
|
|
154
|
+
<body>
|
|
155
|
+
<h1>Chapter 1</h1>
|
|
156
|
+
<p>At first, there were s'mores.</p>
|
|
157
|
+
</body>
|
|
158
|
+
</html>`
|
|
159
|
+
|
|
160
|
+
// Or you can specify the contents as an XML structure
|
|
161
|
+
const xmlContents = epub.createXhtmlDocument([
|
|
162
|
+
Epub.createXmlElement("h1", {}, [Epub.createXmlTextNode("Chapter 1")]),
|
|
163
|
+
Epub.createXmlElement("p", {}, [
|
|
164
|
+
Epub.createXmlTextNode("At first, there were s'mores."),
|
|
165
|
+
]),
|
|
166
|
+
])
|
|
167
|
+
|
|
168
|
+
// First, add the new item to the manifest, and add
|
|
169
|
+
// its contents to the publication
|
|
170
|
+
await epub.addManifestItem(manifestItem, contents, "utf-8")
|
|
171
|
+
|
|
172
|
+
// OR, using the XMl:
|
|
173
|
+
await epub.addManifestItem(manifestItem, xmlContents, "xml")
|
|
174
|
+
|
|
175
|
+
// Then add the item to the spine
|
|
176
|
+
await epub.addSpineItem(manifestItem.id)
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Writing to disk
|
|
180
|
+
|
|
181
|
+
```ts
|
|
182
|
+
import { Epub } from "@storyteller-platform/epub/node"
|
|
183
|
+
|
|
184
|
+
const epub = await Epub.from("path/to/book.epub")
|
|
185
|
+
await epub.setTitle("S'mores for Everyone")
|
|
186
|
+
|
|
187
|
+
await epub.writeToFile("path/to/updated.epub")
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Writing to a byte array
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { randomUUID } from "node:crypto"
|
|
194
|
+
|
|
195
|
+
import { Epub } from "@storyteller-platform/epub"
|
|
196
|
+
|
|
197
|
+
const epub = await Epub.create({
|
|
198
|
+
title: "S'mores For Everyone",
|
|
199
|
+
language: new Intl.Locale("en-US"),
|
|
200
|
+
identifier: randomUUID(),
|
|
201
|
+
})
|
|
202
|
+
|
|
203
|
+
const data: Uint8Array = await epub.writeToArray()
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
For more details about using the API, see the [API documentation](#epub).
|
|
207
|
+
|
|
208
|
+
## Development
|
|
209
|
+
|
|
210
|
+
This package lives in the
|
|
211
|
+
[Storyteller monorepo](https://gitlab.com/storyteller-platform/storyteller), and
|
|
212
|
+
is developed alongside the
|
|
213
|
+
[Storyteller platform](https://storyteller-platform.gitlab.io/storyteller).
|
|
214
|
+
|
|
215
|
+
To get started with developing in the Storyteller monorepo, check out the
|
|
216
|
+
[development guides in the docs](https://storyteller-platform.gitlab.io/storyteller/docs/category/development).
|
|
217
|
+
|
|
218
|
+
## API Docs
|
|
219
|
+
|
|
220
|
+
## Epub
|
|
221
|
+
|
|
222
|
+
Defined in:
|
|
223
|
+
[epub/node.ts:24](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/node.ts#L24)
|
|
224
|
+
|
|
225
|
+
### Extends
|
|
226
|
+
|
|
227
|
+
- `Epub`
|
|
228
|
+
|
|
229
|
+
### Constructors
|
|
230
|
+
|
|
231
|
+
#### Constructor
|
|
232
|
+
|
|
233
|
+
> `protected` **new Epub**(`entries`, `onClose?`): [`Epub`](#epub)
|
|
234
|
+
|
|
235
|
+
Defined in:
|
|
236
|
+
[epub/index.ts:410](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L410)
|
|
237
|
+
|
|
238
|
+
##### Parameters
|
|
239
|
+
|
|
240
|
+
| Parameter | Type |
|
|
241
|
+
| ---------- | ----------------------------------- |
|
|
242
|
+
| `entries` | `EpubEntry`[] |
|
|
243
|
+
| `onClose?` | () => `void` \| `Promise`\<`void`\> |
|
|
244
|
+
|
|
245
|
+
##### Returns
|
|
246
|
+
|
|
247
|
+
[`Epub`](#epub)
|
|
248
|
+
|
|
249
|
+
##### Inherited from
|
|
250
|
+
|
|
251
|
+
`BaseEpub.constructor`
|
|
252
|
+
|
|
253
|
+
### Properties
|
|
254
|
+
|
|
255
|
+
#### xhtmlBuilder
|
|
256
|
+
|
|
257
|
+
> `static` **xhtmlBuilder**: `XMLBuilder`
|
|
258
|
+
|
|
259
|
+
Defined in:
|
|
260
|
+
[epub/index.ts:242](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L242)
|
|
261
|
+
|
|
262
|
+
##### Inherited from
|
|
263
|
+
|
|
264
|
+
`BaseEpub.xhtmlBuilder`
|
|
265
|
+
|
|
266
|
+
#### xhtmlParser
|
|
267
|
+
|
|
268
|
+
> `static` **xhtmlParser**: `XMLParser`
|
|
269
|
+
|
|
270
|
+
Defined in:
|
|
271
|
+
[epub/index.ts:210](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L210)
|
|
272
|
+
|
|
273
|
+
##### Inherited from
|
|
274
|
+
|
|
275
|
+
`BaseEpub.xhtmlParser`
|
|
276
|
+
|
|
277
|
+
#### xmlBuilder
|
|
278
|
+
|
|
279
|
+
> `static` **xmlBuilder**: `XMLBuilder`
|
|
280
|
+
|
|
281
|
+
Defined in:
|
|
282
|
+
[epub/index.ts:235](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L235)
|
|
283
|
+
|
|
284
|
+
##### Inherited from
|
|
285
|
+
|
|
286
|
+
`BaseEpub.xmlBuilder`
|
|
287
|
+
|
|
288
|
+
#### xmlParser
|
|
289
|
+
|
|
290
|
+
> `static` **xmlParser**: `XMLParser`
|
|
291
|
+
|
|
292
|
+
Defined in:
|
|
293
|
+
[epub/index.ts:203](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L203)
|
|
294
|
+
|
|
295
|
+
##### Inherited from
|
|
296
|
+
|
|
297
|
+
`BaseEpub.xmlParser`
|
|
298
|
+
|
|
299
|
+
### Methods
|
|
300
|
+
|
|
301
|
+
#### addCollection()
|
|
302
|
+
|
|
303
|
+
> **addCollection**(`collection`, `index?`): `Promise`\<`void`\>
|
|
304
|
+
|
|
305
|
+
Defined in:
|
|
306
|
+
[epub/index.ts:1520](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1520)
|
|
307
|
+
|
|
308
|
+
Add a collection to the EPUB metadata.
|
|
309
|
+
|
|
310
|
+
If index is provided, the collection will be placed at that index in the list of
|
|
311
|
+
collections. Otherwise, it will be added to the end of the list.
|
|
312
|
+
|
|
313
|
+
##### Parameters
|
|
314
|
+
|
|
315
|
+
| Parameter | Type |
|
|
316
|
+
| ------------ | --------------------------- |
|
|
317
|
+
| `collection` | [`Collection`](#collection) |
|
|
318
|
+
| `index?` | `number` |
|
|
319
|
+
|
|
320
|
+
##### Returns
|
|
321
|
+
|
|
322
|
+
`Promise`\<`void`\>
|
|
323
|
+
|
|
324
|
+
##### Inherited from
|
|
325
|
+
|
|
326
|
+
`BaseEpub.addCollection`
|
|
327
|
+
|
|
328
|
+
#### addContributor()
|
|
329
|
+
|
|
330
|
+
> **addContributor**(`contributor`, `index?`): `Promise`\<`void`\>
|
|
331
|
+
|
|
332
|
+
Defined in:
|
|
333
|
+
[epub/index.ts:1862](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1862)
|
|
334
|
+
|
|
335
|
+
Add a contributor to the EPUB metadata.
|
|
336
|
+
|
|
337
|
+
If index is provided, the creator will be placed at that index in the list of
|
|
338
|
+
creators. Otherwise, it will be added to the end of the list.
|
|
339
|
+
|
|
340
|
+
This is a convenience method for
|
|
341
|
+
`epub.addCreator(contributor, index, 'contributor')`.
|
|
342
|
+
|
|
343
|
+
##### Parameters
|
|
344
|
+
|
|
345
|
+
| Parameter | Type |
|
|
346
|
+
| ------------- | ------------------------- |
|
|
347
|
+
| `contributor` | [`DcCreator`](#dccreator) |
|
|
348
|
+
| `index?` | `number` |
|
|
349
|
+
|
|
350
|
+
##### Returns
|
|
351
|
+
|
|
352
|
+
`Promise`\<`void`\>
|
|
353
|
+
|
|
354
|
+
##### Link
|
|
355
|
+
|
|
356
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
357
|
+
|
|
358
|
+
##### Inherited from
|
|
359
|
+
|
|
360
|
+
`BaseEpub.addContributor`
|
|
361
|
+
|
|
362
|
+
#### addCreator()
|
|
363
|
+
|
|
364
|
+
> **addCreator**(`creator`, `index?`, `type?`): `Promise`\<`void`\>
|
|
365
|
+
|
|
366
|
+
Defined in:
|
|
367
|
+
[epub/index.ts:1707](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1707)
|
|
368
|
+
|
|
369
|
+
Add a creator to the EPUB metadata.
|
|
370
|
+
|
|
371
|
+
If index is provided, the creator will be placed at that index in the list of
|
|
372
|
+
creators. Otherwise, it will be added to the end of the list.
|
|
373
|
+
|
|
374
|
+
##### Parameters
|
|
375
|
+
|
|
376
|
+
| Parameter | Type | Default value |
|
|
377
|
+
| --------- | ------------------------------ | ------------- |
|
|
378
|
+
| `creator` | [`DcCreator`](#dccreator) | `undefined` |
|
|
379
|
+
| `index?` | `number` | `undefined` |
|
|
380
|
+
| `type?` | `"creator"` \| `"contributor"` | `"creator"` |
|
|
381
|
+
|
|
382
|
+
##### Returns
|
|
383
|
+
|
|
384
|
+
`Promise`\<`void`\>
|
|
385
|
+
|
|
386
|
+
##### Link
|
|
387
|
+
|
|
388
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
389
|
+
|
|
390
|
+
##### Inherited from
|
|
391
|
+
|
|
392
|
+
`BaseEpub.addCreator`
|
|
393
|
+
|
|
394
|
+
#### addManifestItem()
|
|
395
|
+
|
|
396
|
+
##### Call Signature
|
|
397
|
+
|
|
398
|
+
> **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
|
|
399
|
+
|
|
400
|
+
Defined in:
|
|
401
|
+
[epub/index.ts:2198](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2198)
|
|
402
|
+
|
|
403
|
+
Create a new manifest item and write its contents to a new entry.
|
|
404
|
+
|
|
405
|
+
###### Parameters
|
|
406
|
+
|
|
407
|
+
| Parameter | Type | Description |
|
|
408
|
+
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
409
|
+
| `item` | [`ManifestItem`](#manifestitem) | - |
|
|
410
|
+
| `contents` | [`ParsedXml`](#parsedxml) | The new contents. May be either a parsed XML tree or a unicode string, as determined by the `as` argument. |
|
|
411
|
+
| `encoding` | `"xml"` | Optional - whether to interpret contents as a parsed XML tree, a unicode string, or a byte array. Defaults to a byte array. |
|
|
412
|
+
|
|
413
|
+
###### Returns
|
|
414
|
+
|
|
415
|
+
`Promise`\<`void`\>
|
|
416
|
+
|
|
417
|
+
###### Link
|
|
418
|
+
|
|
419
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
420
|
+
|
|
421
|
+
###### Link
|
|
422
|
+
|
|
423
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
424
|
+
|
|
425
|
+
###### Inherited from
|
|
426
|
+
|
|
427
|
+
`BaseEpub.addManifestItem`
|
|
428
|
+
|
|
429
|
+
##### Call Signature
|
|
430
|
+
|
|
431
|
+
> **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
|
|
432
|
+
|
|
433
|
+
Defined in:
|
|
434
|
+
[epub/index.ts:2203](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2203)
|
|
435
|
+
|
|
436
|
+
Create a new manifest item and write its contents to a new entry.
|
|
437
|
+
|
|
438
|
+
###### Parameters
|
|
439
|
+
|
|
440
|
+
| Parameter | Type | Description |
|
|
441
|
+
| ---------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
442
|
+
| `item` | [`ManifestItem`](#manifestitem) | - |
|
|
443
|
+
| `contents` | `string` | The new contents. May be either a parsed XML tree or a unicode string, as determined by the `as` argument. |
|
|
444
|
+
| `encoding` | `"utf-8"` | Optional - whether to interpret contents as a parsed XML tree, a unicode string, or a byte array. Defaults to a byte array. |
|
|
445
|
+
|
|
446
|
+
###### Returns
|
|
447
|
+
|
|
448
|
+
`Promise`\<`void`\>
|
|
449
|
+
|
|
450
|
+
###### Link
|
|
451
|
+
|
|
452
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
453
|
+
|
|
454
|
+
###### Link
|
|
455
|
+
|
|
456
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
457
|
+
|
|
458
|
+
###### Inherited from
|
|
459
|
+
|
|
460
|
+
`BaseEpub.addManifestItem`
|
|
461
|
+
|
|
462
|
+
##### Call Signature
|
|
463
|
+
|
|
464
|
+
> **addManifestItem**(`item`, `contents`): `Promise`\<`void`\>
|
|
465
|
+
|
|
466
|
+
Defined in:
|
|
467
|
+
[epub/index.ts:2208](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2208)
|
|
468
|
+
|
|
469
|
+
Create a new manifest item and write its contents to a new entry.
|
|
470
|
+
|
|
471
|
+
###### Parameters
|
|
472
|
+
|
|
473
|
+
| Parameter | Type | Description |
|
|
474
|
+
| ---------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
475
|
+
| `item` | [`ManifestItem`](#manifestitem) | - |
|
|
476
|
+
| `contents` | `Uint8Array` | The new contents. May be either a parsed XML tree or a unicode string, as determined by the `as` argument. |
|
|
477
|
+
|
|
478
|
+
###### Returns
|
|
479
|
+
|
|
480
|
+
`Promise`\<`void`\>
|
|
481
|
+
|
|
482
|
+
###### Link
|
|
483
|
+
|
|
484
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
485
|
+
|
|
486
|
+
###### Link
|
|
487
|
+
|
|
488
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
489
|
+
|
|
490
|
+
###### Inherited from
|
|
491
|
+
|
|
492
|
+
`BaseEpub.addManifestItem`
|
|
493
|
+
|
|
494
|
+
#### addMetadata()
|
|
495
|
+
|
|
496
|
+
> **addMetadata**(`entry`): `Promise`\<`void`\>
|
|
497
|
+
|
|
498
|
+
Defined in:
|
|
499
|
+
[epub/index.ts:2317](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2317)
|
|
500
|
+
|
|
501
|
+
Add a new metadata entry to the Epub.
|
|
502
|
+
|
|
503
|
+
This method, like `epub.getMetadata()`, operates on metadata entries. For more
|
|
504
|
+
useful semantic representations of metadata, use specific methods such as
|
|
505
|
+
`setTitle()` and `setLanguage()`.
|
|
506
|
+
|
|
507
|
+
##### Parameters
|
|
508
|
+
|
|
509
|
+
| Parameter | Type |
|
|
510
|
+
| --------- | --------------------------------- |
|
|
511
|
+
| `entry` | [`MetadataEntry`](#metadataentry) |
|
|
512
|
+
|
|
513
|
+
##### Returns
|
|
514
|
+
|
|
515
|
+
`Promise`\<`void`\>
|
|
516
|
+
|
|
517
|
+
##### Link
|
|
518
|
+
|
|
519
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
520
|
+
|
|
521
|
+
##### Inherited from
|
|
522
|
+
|
|
523
|
+
`BaseEpub.addMetadata`
|
|
524
|
+
|
|
525
|
+
#### addSpineItem()
|
|
526
|
+
|
|
527
|
+
> **addSpineItem**(`manifestId`, `index?`): `Promise`\<`void`\>
|
|
528
|
+
|
|
529
|
+
Defined in:
|
|
530
|
+
[epub/index.ts:1916](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1916)
|
|
531
|
+
|
|
532
|
+
Add an item to the spine of the EPUB.
|
|
533
|
+
|
|
534
|
+
If `index` is undefined, the item will be added to the end of the spine.
|
|
535
|
+
Otherwise it will be inserted at the specified index.
|
|
536
|
+
|
|
537
|
+
If the manifestId does not correspond to an item in the manifest, this will
|
|
538
|
+
throw an error.
|
|
539
|
+
|
|
540
|
+
##### Parameters
|
|
541
|
+
|
|
542
|
+
| Parameter | Type |
|
|
543
|
+
| ------------ | -------- |
|
|
544
|
+
| `manifestId` | `string` |
|
|
545
|
+
| `index?` | `number` |
|
|
546
|
+
|
|
547
|
+
##### Returns
|
|
548
|
+
|
|
549
|
+
`Promise`\<`void`\>
|
|
550
|
+
|
|
551
|
+
##### Link
|
|
552
|
+
|
|
553
|
+
https://www.w3.org/TR/epub-33/#sec-spine-elem
|
|
554
|
+
|
|
555
|
+
##### Inherited from
|
|
556
|
+
|
|
557
|
+
`BaseEpub.addSpineItem`
|
|
558
|
+
|
|
559
|
+
#### addSubject()
|
|
560
|
+
|
|
561
|
+
> **addSubject**(`subject`): `Promise`\<`void`\>
|
|
562
|
+
|
|
563
|
+
Defined in:
|
|
564
|
+
[epub/index.ts:1052](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1052)
|
|
565
|
+
|
|
566
|
+
Add a subject to the EPUB metadata.
|
|
567
|
+
|
|
568
|
+
##### Parameters
|
|
569
|
+
|
|
570
|
+
| Parameter | Type | Description |
|
|
571
|
+
| --------- | ------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
572
|
+
| `subject` | `string` \| [`DcSubject`](#dcsubject) | May be a string representing just a schema-less subject name, or a DcSubject object |
|
|
573
|
+
|
|
574
|
+
##### Returns
|
|
575
|
+
|
|
576
|
+
`Promise`\<`void`\>
|
|
577
|
+
|
|
578
|
+
##### Link
|
|
579
|
+
|
|
580
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
|
|
581
|
+
|
|
582
|
+
##### Inherited from
|
|
583
|
+
|
|
584
|
+
`BaseEpub.addSubject`
|
|
585
|
+
|
|
586
|
+
#### close()
|
|
587
|
+
|
|
588
|
+
> **close**(): `Promise`\<`void`\>
|
|
589
|
+
|
|
590
|
+
Defined in:
|
|
591
|
+
[epub/index.ts:430](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L430)
|
|
592
|
+
|
|
593
|
+
Close the Epub. Must be called before the Epub goes out of scope/is garbage
|
|
594
|
+
collected.
|
|
595
|
+
|
|
596
|
+
##### Returns
|
|
597
|
+
|
|
598
|
+
`Promise`\<`void`\>
|
|
599
|
+
|
|
600
|
+
##### Inherited from
|
|
601
|
+
|
|
602
|
+
`BaseEpub.close`
|
|
603
|
+
|
|
604
|
+
#### createXhtmlDocument()
|
|
605
|
+
|
|
606
|
+
> **createXhtmlDocument**(`body`, `head?`, `language?`):
|
|
607
|
+
> `Promise`\<([`XmlElement`](#xmlelement)\<`"html"`\> \|
|
|
608
|
+
> [`XmlElement`](#xmlelement)\<`"?xml"`\>)[]\>
|
|
609
|
+
|
|
610
|
+
Defined in:
|
|
611
|
+
[epub/index.ts:2021](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2021)
|
|
612
|
+
|
|
613
|
+
Create a new XHTML document with the given body and head.
|
|
614
|
+
|
|
615
|
+
##### Parameters
|
|
616
|
+
|
|
617
|
+
| Parameter | Type | Description |
|
|
618
|
+
| ----------- | ------------------------- | -------------------------------------------------- |
|
|
619
|
+
| `body` | [`ParsedXml`](#parsedxml) | The XML nodes to place in the body of the document |
|
|
620
|
+
| `head?` | [`ParsedXml`](#parsedxml) | Optional - the XMl nodes to place in the head |
|
|
621
|
+
| `language?` | `Locale` | Optional - defaults to the EPUB's language |
|
|
622
|
+
|
|
623
|
+
##### Returns
|
|
624
|
+
|
|
625
|
+
`Promise`\<([`XmlElement`](#xmlelement)\<`"html"`\> \|
|
|
626
|
+
[`XmlElement`](#xmlelement)\<`"?xml"`\>)[]\>
|
|
627
|
+
|
|
628
|
+
##### Inherited from
|
|
629
|
+
|
|
630
|
+
`BaseEpub.createXhtmlDocument`
|
|
631
|
+
|
|
632
|
+
#### findAllMetadataItems()
|
|
633
|
+
|
|
634
|
+
> **findAllMetadataItems**(`predicate`): `Promise`\<`object`[]\>
|
|
635
|
+
|
|
636
|
+
Defined in:
|
|
637
|
+
[epub/index.ts:805](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L805)
|
|
638
|
+
|
|
639
|
+
Returns the item in the metadata element's children array that matches the
|
|
640
|
+
provided predicate.
|
|
641
|
+
|
|
642
|
+
##### Parameters
|
|
643
|
+
|
|
644
|
+
| Parameter | Type |
|
|
645
|
+
| ----------- | ---------------------- |
|
|
646
|
+
| `predicate` | (`entry`) => `boolean` |
|
|
647
|
+
|
|
648
|
+
##### Returns
|
|
649
|
+
|
|
650
|
+
`Promise`\<`object`[]\>
|
|
651
|
+
|
|
652
|
+
##### Inherited from
|
|
653
|
+
|
|
654
|
+
`BaseEpub.findAllMetadataItems`
|
|
655
|
+
|
|
656
|
+
#### findMetadataItem()
|
|
657
|
+
|
|
658
|
+
> **findMetadataItem**(`predicate`): `Promise`\<`null` \| \{ `id`: `undefined`
|
|
659
|
+
> \| `string`; `properties`: \{[`k`: `string`]: `string`; \}; `type`:
|
|
660
|
+
> `` `a${string}` `` \| `` `b${string}` `` \| `` `c${string}` `` \|
|
|
661
|
+
> `` `d${string}` `` \| `` `e${string}` `` \| `` `f${string}` `` \|
|
|
662
|
+
> `` `g${string}` `` \| `` `h${string}` `` \| `` `i${string}` `` \|
|
|
663
|
+
> `` `j${string}` `` \| `` `k${string}` `` \| `` `l${string}` `` \|
|
|
664
|
+
> `` `m${string}` `` \| `` `n${string}` `` \| `` `o${string}` `` \|
|
|
665
|
+
> `` `p${string}` `` \| `` `q${string}` `` \| `` `r${string}` `` \|
|
|
666
|
+
> `` `s${string}` `` \| `` `t${string}` `` \| `` `u${string}` `` \|
|
|
667
|
+
> `` `v${string}` `` \| `` `w${string}` `` \| `` `x${string}` `` \|
|
|
668
|
+
> `` `y${string}` `` \| `` `z${string}` `` \| `` `A${string}` `` \|
|
|
669
|
+
> `` `B${string}` `` \| `` `C${string}` `` \| `` `D${string}` `` \|
|
|
670
|
+
> `` `E${string}` `` \| `` `F${string}` `` \| `` `G${string}` `` \|
|
|
671
|
+
> `` `H${string}` `` \| `` `I${string}` `` \| `` `J${string}` `` \|
|
|
672
|
+
> `` `K${string}` `` \| `` `L${string}` `` \| `` `M${string}` `` \|
|
|
673
|
+
> `` `N${string}` `` \| `` `O${string}` `` \| `` `P${string}` `` \|
|
|
674
|
+
> `` `Q${string}` `` \| `` `R${string}` `` \| `` `S${string}` `` \|
|
|
675
|
+
> `` `T${string}` `` \| `` `U${string}` `` \| `` `V${string}` `` \|
|
|
676
|
+
> `` `W${string}` `` \| `` `X${string}` `` \| `` `Y${string}` `` \|
|
|
677
|
+
> `` `Z${string}` `` \| `` `?${string}` ``; `value`: `undefined` \| `string`;
|
|
678
|
+
> \}\>
|
|
679
|
+
|
|
680
|
+
Defined in:
|
|
681
|
+
[epub/index.ts:796](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L796)
|
|
682
|
+
|
|
683
|
+
Returns the item in the metadata element's children array that matches the
|
|
684
|
+
provided predicate.
|
|
685
|
+
|
|
686
|
+
##### Parameters
|
|
687
|
+
|
|
688
|
+
| Parameter | Type |
|
|
689
|
+
| ----------- | ---------------------- |
|
|
690
|
+
| `predicate` | (`entry`) => `boolean` |
|
|
691
|
+
|
|
692
|
+
##### Returns
|
|
693
|
+
|
|
694
|
+
`Promise`\<`null` \| \{ `id`: `undefined` \| `string`; `properties`: \{[`k`:
|
|
695
|
+
`string`]: `string`; \}; `type`: `` `a${string}` `` \| `` `b${string}` `` \|
|
|
696
|
+
`` `c${string}` `` \| `` `d${string}` `` \| `` `e${string}` `` \|
|
|
697
|
+
`` `f${string}` `` \| `` `g${string}` `` \| `` `h${string}` `` \|
|
|
698
|
+
`` `i${string}` `` \| `` `j${string}` `` \| `` `k${string}` `` \|
|
|
699
|
+
`` `l${string}` `` \| `` `m${string}` `` \| `` `n${string}` `` \|
|
|
700
|
+
`` `o${string}` `` \| `` `p${string}` `` \| `` `q${string}` `` \|
|
|
701
|
+
`` `r${string}` `` \| `` `s${string}` `` \| `` `t${string}` `` \|
|
|
702
|
+
`` `u${string}` `` \| `` `v${string}` `` \| `` `w${string}` `` \|
|
|
703
|
+
`` `x${string}` `` \| `` `y${string}` `` \| `` `z${string}` `` \|
|
|
704
|
+
`` `A${string}` `` \| `` `B${string}` `` \| `` `C${string}` `` \|
|
|
705
|
+
`` `D${string}` `` \| `` `E${string}` `` \| `` `F${string}` `` \|
|
|
706
|
+
`` `G${string}` `` \| `` `H${string}` `` \| `` `I${string}` `` \|
|
|
707
|
+
`` `J${string}` `` \| `` `K${string}` `` \| `` `L${string}` `` \|
|
|
708
|
+
`` `M${string}` `` \| `` `N${string}` `` \| `` `O${string}` `` \|
|
|
709
|
+
`` `P${string}` `` \| `` `Q${string}` `` \| `` `R${string}` `` \|
|
|
710
|
+
`` `S${string}` `` \| `` `T${string}` `` \| `` `U${string}` `` \|
|
|
711
|
+
`` `V${string}` `` \| `` `W${string}` `` \| `` `X${string}` `` \|
|
|
712
|
+
`` `Y${string}` `` \| `` `Z${string}` `` \| `` `?${string}` ``; `value`:
|
|
713
|
+
`undefined` \| `string`; \}\>
|
|
714
|
+
|
|
715
|
+
##### Inherited from
|
|
716
|
+
|
|
717
|
+
`BaseEpub.findMetadataItem`
|
|
718
|
+
|
|
719
|
+
#### getCollections()
|
|
720
|
+
|
|
721
|
+
> **getCollections**(): `Promise`\<[`Collection`](#collection)[]\>
|
|
722
|
+
|
|
723
|
+
Defined in:
|
|
724
|
+
[epub/index.ts:1480](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1480)
|
|
725
|
+
|
|
726
|
+
Retrieve the list of collections.
|
|
727
|
+
|
|
728
|
+
##### Returns
|
|
729
|
+
|
|
730
|
+
`Promise`\<[`Collection`](#collection)[]\>
|
|
731
|
+
|
|
732
|
+
##### Inherited from
|
|
733
|
+
|
|
734
|
+
`BaseEpub.getCollections`
|
|
735
|
+
|
|
736
|
+
#### getContributors()
|
|
737
|
+
|
|
738
|
+
> **getContributors**(): `Promise`\<[`DcCreator`](#dccreator)[]\>
|
|
739
|
+
|
|
740
|
+
Defined in:
|
|
741
|
+
[epub/index.ts:1694](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1694)
|
|
742
|
+
|
|
743
|
+
Retrieve the list of contributors.
|
|
744
|
+
|
|
745
|
+
This is a convenience method for `epub.getCreators('contributor')`.
|
|
746
|
+
|
|
747
|
+
##### Returns
|
|
748
|
+
|
|
749
|
+
`Promise`\<[`DcCreator`](#dccreator)[]\>
|
|
750
|
+
|
|
751
|
+
##### Link
|
|
752
|
+
|
|
753
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccontributor
|
|
754
|
+
|
|
755
|
+
##### Inherited from
|
|
756
|
+
|
|
757
|
+
`BaseEpub.getContributors`
|
|
758
|
+
|
|
759
|
+
#### getCoverImage()
|
|
760
|
+
|
|
761
|
+
> **getCoverImage**(): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\>
|
|
762
|
+
|
|
763
|
+
Defined in:
|
|
764
|
+
[epub/index.ts:955](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L955)
|
|
765
|
+
|
|
766
|
+
Retrieve the cover image data as a byte array.
|
|
767
|
+
|
|
768
|
+
This does not include, for example, the cover image's filename or mime type. To
|
|
769
|
+
retrieve the image manifest item, use epub.getCoverImageItem().
|
|
770
|
+
|
|
771
|
+
##### Returns
|
|
772
|
+
|
|
773
|
+
`Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\>
|
|
774
|
+
|
|
775
|
+
##### Link
|
|
776
|
+
|
|
777
|
+
https://www.w3.org/TR/epub-33/#sec-cover-image
|
|
778
|
+
|
|
779
|
+
##### Inherited from
|
|
780
|
+
|
|
781
|
+
`BaseEpub.getCoverImage`
|
|
782
|
+
|
|
783
|
+
#### getCoverImageItem()
|
|
784
|
+
|
|
785
|
+
> **getCoverImageItem**(): `Promise`\<`null` \|
|
|
786
|
+
> [`ManifestItem`](#manifestitem)\>
|
|
787
|
+
|
|
788
|
+
Defined in:
|
|
789
|
+
[epub/index.ts:936](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L936)
|
|
790
|
+
|
|
791
|
+
Retrieve the cover image manifest item.
|
|
792
|
+
|
|
793
|
+
This does not return the actual image data. To retrieve the image data, pass
|
|
794
|
+
this item's id to epub.readItemContents, or use epub.getCoverImage() instead.
|
|
795
|
+
|
|
796
|
+
##### Returns
|
|
797
|
+
|
|
798
|
+
`Promise`\<`null` \| [`ManifestItem`](#manifestitem)\>
|
|
799
|
+
|
|
800
|
+
##### Link
|
|
801
|
+
|
|
802
|
+
https://www.w3.org/TR/epub-33/#sec-cover-image
|
|
803
|
+
|
|
804
|
+
##### Inherited from
|
|
805
|
+
|
|
806
|
+
`BaseEpub.getCoverImageItem`
|
|
807
|
+
|
|
808
|
+
#### getCreators()
|
|
809
|
+
|
|
810
|
+
> **getCreators**(`type`): `Promise`\<[`DcCreator`](#dccreator)[]\>
|
|
811
|
+
|
|
812
|
+
Defined in:
|
|
813
|
+
[epub/index.ts:1633](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1633)
|
|
814
|
+
|
|
815
|
+
Retrieve the list of creators.
|
|
816
|
+
|
|
817
|
+
##### Parameters
|
|
818
|
+
|
|
819
|
+
| Parameter | Type | Default value |
|
|
820
|
+
| --------- | ------------------------------ | ------------- |
|
|
821
|
+
| `type` | `"creator"` \| `"contributor"` | `"creator"` |
|
|
822
|
+
|
|
823
|
+
##### Returns
|
|
824
|
+
|
|
825
|
+
`Promise`\<[`DcCreator`](#dccreator)[]\>
|
|
826
|
+
|
|
827
|
+
##### Link
|
|
828
|
+
|
|
829
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
830
|
+
|
|
831
|
+
##### Inherited from
|
|
832
|
+
|
|
833
|
+
`BaseEpub.getCreators`
|
|
834
|
+
|
|
835
|
+
#### getDescription()
|
|
836
|
+
|
|
837
|
+
> **getDescription**(): `Promise`\<`null` \| `string`\>
|
|
838
|
+
|
|
839
|
+
Defined in:
|
|
840
|
+
[epub/index.ts:1330](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1330)
|
|
841
|
+
|
|
842
|
+
Retrieve the Epub's description as specified in its package document metadata.
|
|
843
|
+
|
|
844
|
+
If no description metadata is specified, returns null. Returns the description
|
|
845
|
+
as a string. Descriptions may include HTML markup.
|
|
846
|
+
|
|
847
|
+
##### Returns
|
|
848
|
+
|
|
849
|
+
`Promise`\<`null` \| `string`\>
|
|
850
|
+
|
|
851
|
+
##### Inherited from
|
|
852
|
+
|
|
853
|
+
`BaseEpub.getDescription`
|
|
854
|
+
|
|
855
|
+
#### getLanguage()
|
|
856
|
+
|
|
857
|
+
> **getLanguage**(): `Promise`\<`null` \| `Locale`\>
|
|
858
|
+
|
|
859
|
+
Defined in:
|
|
860
|
+
[epub/index.ts:1171](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1171)
|
|
861
|
+
|
|
862
|
+
Retrieve the Epub's language as specified in its package document metadata.
|
|
863
|
+
|
|
864
|
+
If no language metadata is specified, returns null. Returns the language as an
|
|
865
|
+
Intl.Locale instance.
|
|
866
|
+
|
|
867
|
+
##### Returns
|
|
868
|
+
|
|
869
|
+
`Promise`\<`null` \| `Locale`\>
|
|
870
|
+
|
|
871
|
+
##### Link
|
|
872
|
+
|
|
873
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
|
|
874
|
+
|
|
875
|
+
##### Inherited from
|
|
876
|
+
|
|
877
|
+
`BaseEpub.getLanguage`
|
|
878
|
+
|
|
879
|
+
#### getManifest()
|
|
880
|
+
|
|
881
|
+
> **getManifest**(): `Promise`\<`Record`\<`string`,
|
|
882
|
+
> [`ManifestItem`](#manifestitem)\>\>
|
|
883
|
+
|
|
884
|
+
Defined in:
|
|
885
|
+
[epub/index.ts:721](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L721)
|
|
886
|
+
|
|
887
|
+
Retrieve the manifest for the Epub.
|
|
888
|
+
|
|
889
|
+
This is represented as a map from each manifest items' id to the rest of its
|
|
890
|
+
properties.
|
|
891
|
+
|
|
892
|
+
##### Returns
|
|
893
|
+
|
|
894
|
+
`Promise`\<`Record`\<`string`, [`ManifestItem`](#manifestitem)\>\>
|
|
895
|
+
|
|
896
|
+
##### Link
|
|
897
|
+
|
|
898
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
899
|
+
|
|
900
|
+
##### Inherited from
|
|
901
|
+
|
|
902
|
+
`BaseEpub.getManifest`
|
|
903
|
+
|
|
904
|
+
#### getMetadata()
|
|
905
|
+
|
|
906
|
+
> **getMetadata**(): `Promise`\<[`EpubMetadata`](#epubmetadata)\>
|
|
907
|
+
|
|
908
|
+
Defined in:
|
|
909
|
+
[epub/index.ts:872](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L872)
|
|
910
|
+
|
|
911
|
+
Retrieve the metadata entries for the Epub.
|
|
912
|
+
|
|
913
|
+
This is represented as an array of metadata entries, in the order that they're
|
|
914
|
+
presented in the Epub package document.
|
|
915
|
+
|
|
916
|
+
For more useful semantic representations of metadata, use specific methods such
|
|
917
|
+
as `getTitle()` and `getAuthors()`.
|
|
918
|
+
|
|
919
|
+
##### Returns
|
|
920
|
+
|
|
921
|
+
`Promise`\<[`EpubMetadata`](#epubmetadata)\>
|
|
922
|
+
|
|
923
|
+
##### Link
|
|
924
|
+
|
|
925
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
926
|
+
|
|
927
|
+
##### Inherited from
|
|
928
|
+
|
|
929
|
+
`BaseEpub.getMetadata`
|
|
930
|
+
|
|
931
|
+
#### getPackageVocabularyPrefixes()
|
|
932
|
+
|
|
933
|
+
> **getPackageVocabularyPrefixes**(): `Promise`\<`Record`\<`string`,
|
|
934
|
+
> `string`\>\>
|
|
935
|
+
|
|
936
|
+
Defined in:
|
|
937
|
+
[epub/index.ts:1348](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1348)
|
|
938
|
+
|
|
939
|
+
Return the set of custom vocabulary prefixes set on this publication's root
|
|
940
|
+
package element.
|
|
941
|
+
|
|
942
|
+
Returns a map from prefix to URI
|
|
943
|
+
|
|
944
|
+
##### Returns
|
|
945
|
+
|
|
946
|
+
`Promise`\<`Record`\<`string`, `string`\>\>
|
|
947
|
+
|
|
948
|
+
##### Link
|
|
949
|
+
|
|
950
|
+
https://www.w3.org/TR/epub-33/#sec-prefix-attr
|
|
951
|
+
|
|
952
|
+
##### Inherited from
|
|
953
|
+
|
|
954
|
+
`BaseEpub.getPackageVocabularyPrefixes`
|
|
955
|
+
|
|
956
|
+
#### getPublicationDate()
|
|
957
|
+
|
|
958
|
+
> **getPublicationDate**(): `Promise`\<`null` \| `Date`\>
|
|
959
|
+
|
|
960
|
+
Defined in:
|
|
961
|
+
[epub/index.ts:992](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L992)
|
|
962
|
+
|
|
963
|
+
Retrieve the publication date from the dc:date element in the EPUB metadata as a
|
|
964
|
+
Date object.
|
|
965
|
+
|
|
966
|
+
If there is no dc:date element, returns null.
|
|
967
|
+
|
|
968
|
+
##### Returns
|
|
969
|
+
|
|
970
|
+
`Promise`\<`null` \| `Date`\>
|
|
971
|
+
|
|
972
|
+
##### Link
|
|
973
|
+
|
|
974
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dcdate
|
|
975
|
+
|
|
976
|
+
##### Inherited from
|
|
977
|
+
|
|
978
|
+
`BaseEpub.getPublicationDate`
|
|
979
|
+
|
|
980
|
+
#### getSpineItems()
|
|
981
|
+
|
|
982
|
+
> **getSpineItems**(): `Promise`\<[`ManifestItem`](#manifestitem)[]\>
|
|
983
|
+
|
|
984
|
+
Defined in:
|
|
985
|
+
[epub/index.ts:1897](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1897)
|
|
986
|
+
|
|
987
|
+
Retrieve the manifest items that make up the Epub's spine.
|
|
988
|
+
|
|
989
|
+
The spine specifies the order that the contents of the Epub should be displayed
|
|
990
|
+
to users by default.
|
|
991
|
+
|
|
992
|
+
##### Returns
|
|
993
|
+
|
|
994
|
+
`Promise`\<[`ManifestItem`](#manifestitem)[]\>
|
|
995
|
+
|
|
996
|
+
##### Link
|
|
997
|
+
|
|
998
|
+
https://www.w3.org/TR/epub-33/#sec-spine-elem
|
|
999
|
+
|
|
1000
|
+
##### Inherited from
|
|
1001
|
+
|
|
1002
|
+
`BaseEpub.getSpineItems`
|
|
1003
|
+
|
|
1004
|
+
#### getSubjects()
|
|
1005
|
+
|
|
1006
|
+
> **getSubjects**(): `Promise`\<(`string` \| [`DcSubject`](#dcsubject))[]\>
|
|
1007
|
+
|
|
1008
|
+
Defined in:
|
|
1009
|
+
[epub/index.ts:1126](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1126)
|
|
1010
|
+
|
|
1011
|
+
Retrieve the list of subjects for this EPUB.
|
|
1012
|
+
|
|
1013
|
+
Subjects without associated authority and term metadata will be returned as
|
|
1014
|
+
strings. Otherwise, they will be represented as DcSubject objects, with a value,
|
|
1015
|
+
authority, and term.
|
|
1016
|
+
|
|
1017
|
+
##### Returns
|
|
1018
|
+
|
|
1019
|
+
`Promise`\<(`string` \| [`DcSubject`](#dcsubject))[]\>
|
|
1020
|
+
|
|
1021
|
+
##### Link
|
|
1022
|
+
|
|
1023
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
|
|
1024
|
+
|
|
1025
|
+
##### Inherited from
|
|
1026
|
+
|
|
1027
|
+
`BaseEpub.getSubjects`
|
|
1028
|
+
|
|
1029
|
+
#### getSubtitle()
|
|
1030
|
+
|
|
1031
|
+
> **getSubtitle**(): `Promise`\<`null` \| `string`\>
|
|
1032
|
+
|
|
1033
|
+
Defined in:
|
|
1034
|
+
[epub/index.ts:1237](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1237)
|
|
1035
|
+
|
|
1036
|
+
Retrieve the subtitle of the Epub, if it exists.
|
|
1037
|
+
|
|
1038
|
+
##### Returns
|
|
1039
|
+
|
|
1040
|
+
`Promise`\<`null` \| `string`\>
|
|
1041
|
+
|
|
1042
|
+
##### Link
|
|
1043
|
+
|
|
1044
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
1045
|
+
|
|
1046
|
+
##### Inherited from
|
|
1047
|
+
|
|
1048
|
+
`BaseEpub.getSubtitle`
|
|
1049
|
+
|
|
1050
|
+
#### getTitle()
|
|
1051
|
+
|
|
1052
|
+
> **getTitle**(`expanded`): `Promise`\<`null` \| `string`\>
|
|
1053
|
+
|
|
1054
|
+
Defined in:
|
|
1055
|
+
[epub/index.ts:1213](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1213)
|
|
1056
|
+
|
|
1057
|
+
Retrieve the title of the Epub.
|
|
1058
|
+
|
|
1059
|
+
##### Parameters
|
|
1060
|
+
|
|
1061
|
+
| Parameter | Type | Default value |
|
|
1062
|
+
| ---------- | --------- | ------------- |
|
|
1063
|
+
| `expanded` | `boolean` | `false` |
|
|
1064
|
+
|
|
1065
|
+
##### Returns
|
|
1066
|
+
|
|
1067
|
+
`Promise`\<`null` \| `string`\>
|
|
1068
|
+
|
|
1069
|
+
##### Link
|
|
1070
|
+
|
|
1071
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
1072
|
+
|
|
1073
|
+
##### Inherited from
|
|
1074
|
+
|
|
1075
|
+
`BaseEpub.getTitle`
|
|
1076
|
+
|
|
1077
|
+
#### getTitles()
|
|
1078
|
+
|
|
1079
|
+
> **getTitles**(): `Promise`\<`object`[]\>
|
|
1080
|
+
|
|
1081
|
+
Defined in:
|
|
1082
|
+
[epub/index.ts:1249](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1249)
|
|
1083
|
+
|
|
1084
|
+
Retrieve all title entries of the Epub.
|
|
1085
|
+
|
|
1086
|
+
##### Returns
|
|
1087
|
+
|
|
1088
|
+
`Promise`\<`object`[]\>
|
|
1089
|
+
|
|
1090
|
+
##### Link
|
|
1091
|
+
|
|
1092
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
1093
|
+
|
|
1094
|
+
##### Inherited from
|
|
1095
|
+
|
|
1096
|
+
`BaseEpub.getTitles`
|
|
1097
|
+
|
|
1098
|
+
#### getType()
|
|
1099
|
+
|
|
1100
|
+
> **getType**(): `Promise`\<`null` \| [`MetadataEntry`](#metadataentry)\>
|
|
1101
|
+
|
|
1102
|
+
Defined in:
|
|
1103
|
+
[epub/index.ts:1039](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1039)
|
|
1104
|
+
|
|
1105
|
+
Retrieve the publication type from the dc:type element in the EPUB metadata.
|
|
1106
|
+
|
|
1107
|
+
If there is no dc:type element, returns null.
|
|
1108
|
+
|
|
1109
|
+
##### Returns
|
|
1110
|
+
|
|
1111
|
+
`Promise`\<`null` \| [`MetadataEntry`](#metadataentry)\>
|
|
1112
|
+
|
|
1113
|
+
##### Link
|
|
1114
|
+
|
|
1115
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dctype
|
|
1116
|
+
|
|
1117
|
+
##### Inherited from
|
|
1118
|
+
|
|
1119
|
+
`BaseEpub.getType`
|
|
1120
|
+
|
|
1121
|
+
#### readItemContents()
|
|
1122
|
+
|
|
1123
|
+
##### Call Signature
|
|
1124
|
+
|
|
1125
|
+
> **readItemContents**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
1126
|
+
|
|
1127
|
+
Defined in:
|
|
1128
|
+
[epub/index.ts:1993](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1993)
|
|
1129
|
+
|
|
1130
|
+
Retrieve the contents of a manifest item, given its id.
|
|
1131
|
+
|
|
1132
|
+
###### Parameters
|
|
1133
|
+
|
|
1134
|
+
| Parameter | Type | Description |
|
|
1135
|
+
| --------- | -------- | --------------------------------------- |
|
|
1136
|
+
| `id` | `string` | The id of the manifest item to retrieve |
|
|
1137
|
+
|
|
1138
|
+
###### Returns
|
|
1139
|
+
|
|
1140
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
1141
|
+
|
|
1142
|
+
###### Link
|
|
1143
|
+
|
|
1144
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
1145
|
+
|
|
1146
|
+
###### Inherited from
|
|
1147
|
+
|
|
1148
|
+
`BaseEpub.readItemContents`
|
|
1149
|
+
|
|
1150
|
+
##### Call Signature
|
|
1151
|
+
|
|
1152
|
+
> **readItemContents**(`id`, `encoding`): `Promise`\<`string`\>
|
|
1153
|
+
|
|
1154
|
+
Defined in:
|
|
1155
|
+
[epub/index.ts:1994](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1994)
|
|
1156
|
+
|
|
1157
|
+
Retrieve the contents of a manifest item, given its id.
|
|
1158
|
+
|
|
1159
|
+
###### Parameters
|
|
1160
|
+
|
|
1161
|
+
| Parameter | Type | Description |
|
|
1162
|
+
| ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1163
|
+
| `id` | `string` | The id of the manifest item to retrieve |
|
|
1164
|
+
| `encoding` | `"utf-8"` | Optional - must be the string "utf-8". If provided, the function will encode the data into a unicode string. Otherwise, the data will be returned as a byte array. |
|
|
1165
|
+
|
|
1166
|
+
###### Returns
|
|
1167
|
+
|
|
1168
|
+
`Promise`\<`string`\>
|
|
1169
|
+
|
|
1170
|
+
###### Link
|
|
1171
|
+
|
|
1172
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
1173
|
+
|
|
1174
|
+
###### Inherited from
|
|
1175
|
+
|
|
1176
|
+
`BaseEpub.readItemContents`
|
|
1177
|
+
|
|
1178
|
+
#### readXhtmlItemContents()
|
|
1179
|
+
|
|
1180
|
+
##### Call Signature
|
|
1181
|
+
|
|
1182
|
+
> **readXhtmlItemContents**(`id`, `as?`): `Promise`\<[`ParsedXml`](#parsedxml)\>
|
|
1183
|
+
|
|
1184
|
+
Defined in:
|
|
1185
|
+
[epub/index.ts:2054](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2054)
|
|
1186
|
+
|
|
1187
|
+
Retrieves the contents of an XHTML item, given its manifest id.
|
|
1188
|
+
|
|
1189
|
+
###### Parameters
|
|
1190
|
+
|
|
1191
|
+
| Parameter | Type | Description |
|
|
1192
|
+
| --------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1193
|
+
| `id` | `string` | The id of the manifest item to retrieve |
|
|
1194
|
+
| `as?` | `"xhtml"` | Optional - whether to return the parsed XML document tree, or the concatenated text of the document. Defaults to the parsed XML tree. |
|
|
1195
|
+
|
|
1196
|
+
###### Returns
|
|
1197
|
+
|
|
1198
|
+
`Promise`\<[`ParsedXml`](#parsedxml)\>
|
|
1199
|
+
|
|
1200
|
+
###### Link
|
|
1201
|
+
|
|
1202
|
+
https://www.w3.org/TR/epub-33/#sec-xhtml
|
|
1203
|
+
|
|
1204
|
+
###### Inherited from
|
|
1205
|
+
|
|
1206
|
+
`BaseEpub.readXhtmlItemContents`
|
|
1207
|
+
|
|
1208
|
+
##### Call Signature
|
|
1209
|
+
|
|
1210
|
+
> **readXhtmlItemContents**(`id`, `as`): `Promise`\<`string`\>
|
|
1211
|
+
|
|
1212
|
+
Defined in:
|
|
1213
|
+
[epub/index.ts:2055](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2055)
|
|
1214
|
+
|
|
1215
|
+
Retrieves the contents of an XHTML item, given its manifest id.
|
|
1216
|
+
|
|
1217
|
+
###### Parameters
|
|
1218
|
+
|
|
1219
|
+
| Parameter | Type | Description |
|
|
1220
|
+
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1221
|
+
| `id` | `string` | The id of the manifest item to retrieve |
|
|
1222
|
+
| `as` | `"text"` | Optional - whether to return the parsed XML document tree, or the concatenated text of the document. Defaults to the parsed XML tree. |
|
|
1223
|
+
|
|
1224
|
+
###### Returns
|
|
1225
|
+
|
|
1226
|
+
`Promise`\<`string`\>
|
|
1227
|
+
|
|
1228
|
+
###### Link
|
|
1229
|
+
|
|
1230
|
+
https://www.w3.org/TR/epub-33/#sec-xhtml
|
|
1231
|
+
|
|
1232
|
+
###### Inherited from
|
|
1233
|
+
|
|
1234
|
+
`BaseEpub.readXhtmlItemContents`
|
|
1235
|
+
|
|
1236
|
+
#### removeCollection()
|
|
1237
|
+
|
|
1238
|
+
> **removeCollection**(`index`): `Promise`\<`void`\>
|
|
1239
|
+
|
|
1240
|
+
Defined in:
|
|
1241
|
+
[epub/index.ts:1589](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1589)
|
|
1242
|
+
|
|
1243
|
+
Remove a collection from the EPUB metadata.
|
|
1244
|
+
|
|
1245
|
+
Removes the collection at the provided index. This index refers to the array
|
|
1246
|
+
returned by `epub.getCollections()`.
|
|
1247
|
+
|
|
1248
|
+
##### Parameters
|
|
1249
|
+
|
|
1250
|
+
| Parameter | Type |
|
|
1251
|
+
| --------- | -------- |
|
|
1252
|
+
| `index` | `number` |
|
|
1253
|
+
|
|
1254
|
+
##### Returns
|
|
1255
|
+
|
|
1256
|
+
`Promise`\<`void`\>
|
|
1257
|
+
|
|
1258
|
+
##### Inherited from
|
|
1259
|
+
|
|
1260
|
+
`BaseEpub.removeCollection`
|
|
1261
|
+
|
|
1262
|
+
#### removeContributor()
|
|
1263
|
+
|
|
1264
|
+
> **removeContributor**(`index`): `Promise`\<`void`\>
|
|
1265
|
+
|
|
1266
|
+
Defined in:
|
|
1267
|
+
[epub/index.ts:1846](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1846)
|
|
1268
|
+
|
|
1269
|
+
Remove a contributor from the EPUB metadata.
|
|
1270
|
+
|
|
1271
|
+
Removes the contributor at the provided index. This index refers to the array
|
|
1272
|
+
returned by `epub.getContributors()`.
|
|
1273
|
+
|
|
1274
|
+
This is a convenience method for `epub.removeCreator(index, 'contributor')`.
|
|
1275
|
+
|
|
1276
|
+
##### Parameters
|
|
1277
|
+
|
|
1278
|
+
| Parameter | Type |
|
|
1279
|
+
| --------- | -------- |
|
|
1280
|
+
| `index` | `number` |
|
|
1281
|
+
|
|
1282
|
+
##### Returns
|
|
1283
|
+
|
|
1284
|
+
`Promise`\<`void`\>
|
|
1285
|
+
|
|
1286
|
+
##### Link
|
|
1287
|
+
|
|
1288
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
1289
|
+
|
|
1290
|
+
##### Inherited from
|
|
1291
|
+
|
|
1292
|
+
`BaseEpub.removeContributor`
|
|
1293
|
+
|
|
1294
|
+
#### removeCreator()
|
|
1295
|
+
|
|
1296
|
+
> **removeCreator**(`index`, `type`): `Promise`\<`void`\>
|
|
1297
|
+
|
|
1298
|
+
Defined in:
|
|
1299
|
+
[epub/index.ts:1794](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1794)
|
|
1300
|
+
|
|
1301
|
+
Remove a creator from the EPUB metadata.
|
|
1302
|
+
|
|
1303
|
+
Removes the creator at the provided index. This index refers to the array
|
|
1304
|
+
returned by `epub.getCreators()`.
|
|
1305
|
+
|
|
1306
|
+
##### Parameters
|
|
1307
|
+
|
|
1308
|
+
| Parameter | Type | Default value |
|
|
1309
|
+
| --------- | ------------------------------ | ------------- |
|
|
1310
|
+
| `index` | `number` | `undefined` |
|
|
1311
|
+
| `type` | `"creator"` \| `"contributor"` | `"creator"` |
|
|
1312
|
+
|
|
1313
|
+
##### Returns
|
|
1314
|
+
|
|
1315
|
+
`Promise`\<`void`\>
|
|
1316
|
+
|
|
1317
|
+
##### Link
|
|
1318
|
+
|
|
1319
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
1320
|
+
|
|
1321
|
+
##### Inherited from
|
|
1322
|
+
|
|
1323
|
+
`BaseEpub.removeCreator`
|
|
1324
|
+
|
|
1325
|
+
#### removeManifestItem()
|
|
1326
|
+
|
|
1327
|
+
> **removeManifestItem**(`id`): `Promise`\<`void`\>
|
|
1328
|
+
|
|
1329
|
+
Defined in:
|
|
1330
|
+
[epub/index.ts:2155](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2155)
|
|
1331
|
+
|
|
1332
|
+
##### Parameters
|
|
1333
|
+
|
|
1334
|
+
| Parameter | Type |
|
|
1335
|
+
| --------- | -------- |
|
|
1336
|
+
| `id` | `string` |
|
|
1337
|
+
|
|
1338
|
+
##### Returns
|
|
1339
|
+
|
|
1340
|
+
`Promise`\<`void`\>
|
|
1341
|
+
|
|
1342
|
+
##### Inherited from
|
|
1343
|
+
|
|
1344
|
+
`BaseEpub.removeManifestItem`
|
|
1345
|
+
|
|
1346
|
+
#### removeMetadata()
|
|
1347
|
+
|
|
1348
|
+
> **removeMetadata**(`predicate`): `Promise`\<`void`\>
|
|
1349
|
+
|
|
1350
|
+
Defined in:
|
|
1351
|
+
[epub/index.ts:2401](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2401)
|
|
1352
|
+
|
|
1353
|
+
Remove one or more metadata entries.
|
|
1354
|
+
|
|
1355
|
+
The `predicate` argument will be used to determine which entries to remove. The
|
|
1356
|
+
all metadata entries that match the predicate will be removed.
|
|
1357
|
+
|
|
1358
|
+
##### Parameters
|
|
1359
|
+
|
|
1360
|
+
| Parameter | Type | Description |
|
|
1361
|
+
| ----------- | ---------------------- | ------------------------------------------------------------------------------------ |
|
|
1362
|
+
| `predicate` | (`entry`) => `boolean` | Calls predicate once for each metadata entry, removing any for which it returns true |
|
|
1363
|
+
|
|
1364
|
+
##### Returns
|
|
1365
|
+
|
|
1366
|
+
`Promise`\<`void`\>
|
|
1367
|
+
|
|
1368
|
+
##### Link
|
|
1369
|
+
|
|
1370
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
1371
|
+
|
|
1372
|
+
##### Inherited from
|
|
1373
|
+
|
|
1374
|
+
`BaseEpub.removeMetadata`
|
|
1375
|
+
|
|
1376
|
+
#### removeSpineItem()
|
|
1377
|
+
|
|
1378
|
+
> **removeSpineItem**(`index`): `Promise`\<`void`\>
|
|
1379
|
+
|
|
1380
|
+
Defined in:
|
|
1381
|
+
[epub/index.ts:1952](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1952)
|
|
1382
|
+
|
|
1383
|
+
Remove the spine item at the specified index.
|
|
1384
|
+
|
|
1385
|
+
##### Parameters
|
|
1386
|
+
|
|
1387
|
+
| Parameter | Type |
|
|
1388
|
+
| --------- | -------- |
|
|
1389
|
+
| `index` | `number` |
|
|
1390
|
+
|
|
1391
|
+
##### Returns
|
|
1392
|
+
|
|
1393
|
+
`Promise`\<`void`\>
|
|
1394
|
+
|
|
1395
|
+
##### Link
|
|
1396
|
+
|
|
1397
|
+
https://www.w3.org/TR/epub-33/#sec-spine-elem
|
|
1398
|
+
|
|
1399
|
+
##### Inherited from
|
|
1400
|
+
|
|
1401
|
+
`BaseEpub.removeSpineItem`
|
|
1402
|
+
|
|
1403
|
+
#### removeSubject()
|
|
1404
|
+
|
|
1405
|
+
> **removeSubject**(`index`): `Promise`\<`void`\>
|
|
1406
|
+
|
|
1407
|
+
Defined in:
|
|
1408
|
+
[epub/index.ts:1089](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1089)
|
|
1409
|
+
|
|
1410
|
+
Remove a subject from the EPUB metadata.
|
|
1411
|
+
|
|
1412
|
+
Removes the subject at the provided index. This index refers to the array
|
|
1413
|
+
returned by `epub.getSubjects()`.
|
|
1414
|
+
|
|
1415
|
+
##### Parameters
|
|
1416
|
+
|
|
1417
|
+
| Parameter | Type |
|
|
1418
|
+
| --------- | -------- |
|
|
1419
|
+
| `index` | `number` |
|
|
1420
|
+
|
|
1421
|
+
##### Returns
|
|
1422
|
+
|
|
1423
|
+
`Promise`\<`void`\>
|
|
1424
|
+
|
|
1425
|
+
##### Link
|
|
1426
|
+
|
|
1427
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
1428
|
+
|
|
1429
|
+
##### Inherited from
|
|
1430
|
+
|
|
1431
|
+
`BaseEpub.removeSubject`
|
|
1432
|
+
|
|
1433
|
+
#### replaceMetadata()
|
|
1434
|
+
|
|
1435
|
+
> **replaceMetadata**(`predicate`, `entry`): `Promise`\<`void`\>
|
|
1436
|
+
|
|
1437
|
+
Defined in:
|
|
1438
|
+
[epub/index.ts:2356](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2356)
|
|
1439
|
+
|
|
1440
|
+
Replace a metadata entry with a new one.
|
|
1441
|
+
|
|
1442
|
+
The `predicate` argument will be used to determine which entry to replace. The
|
|
1443
|
+
first metadata entry that matches the predicate will be replaced.
|
|
1444
|
+
|
|
1445
|
+
##### Parameters
|
|
1446
|
+
|
|
1447
|
+
| Parameter | Type | Description |
|
|
1448
|
+
| ----------- | --------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
1449
|
+
| `predicate` | (`entry`) => `boolean` | Calls predicate once for each metadata entry, until it finds one where predicate returns true |
|
|
1450
|
+
| `entry` | [`MetadataEntry`](#metadataentry) | The new entry to replace the found entry with |
|
|
1451
|
+
|
|
1452
|
+
##### Returns
|
|
1453
|
+
|
|
1454
|
+
`Promise`\<`void`\>
|
|
1455
|
+
|
|
1456
|
+
##### Link
|
|
1457
|
+
|
|
1458
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
1459
|
+
|
|
1460
|
+
##### Inherited from
|
|
1461
|
+
|
|
1462
|
+
`BaseEpub.replaceMetadata`
|
|
1463
|
+
|
|
1464
|
+
#### setCoverImage()
|
|
1465
|
+
|
|
1466
|
+
> **setCoverImage**(`href`, `data`): `Promise`\<`void`\>
|
|
1467
|
+
|
|
1468
|
+
Defined in:
|
|
1469
|
+
[epub/index.ts:969](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L969)
|
|
1470
|
+
|
|
1471
|
+
Set the cover image for the EPUB.
|
|
1472
|
+
|
|
1473
|
+
Adds a manifest item with the `cover-image` property, per the EPUB 3 spec, and
|
|
1474
|
+
then writes the provided image data to the provided href within the publication.
|
|
1475
|
+
|
|
1476
|
+
##### Parameters
|
|
1477
|
+
|
|
1478
|
+
| Parameter | Type |
|
|
1479
|
+
| --------- | ------------ |
|
|
1480
|
+
| `href` | `string` |
|
|
1481
|
+
| `data` | `Uint8Array` |
|
|
1482
|
+
|
|
1483
|
+
##### Returns
|
|
1484
|
+
|
|
1485
|
+
`Promise`\<`void`\>
|
|
1486
|
+
|
|
1487
|
+
##### Inherited from
|
|
1488
|
+
|
|
1489
|
+
`BaseEpub.setCoverImage`
|
|
1490
|
+
|
|
1491
|
+
#### setDescription()
|
|
1492
|
+
|
|
1493
|
+
> **setDescription**(`description`): `Promise`\<`void`\>
|
|
1494
|
+
|
|
1495
|
+
Defined in:
|
|
1496
|
+
[epub/index.ts:1314](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1314)
|
|
1497
|
+
|
|
1498
|
+
Update the Epub's description metadata entry.
|
|
1499
|
+
|
|
1500
|
+
Updates the existing dc:description element if one exists. Otherwise creates a
|
|
1501
|
+
new element. Any non-ASCII symbols, `&`, `<`, `>`, `"`, `'`, and ```` will be
|
|
1502
|
+
encoded as HTML entities.
|
|
1503
|
+
|
|
1504
|
+
##### Parameters
|
|
1505
|
+
|
|
1506
|
+
| Parameter | Type |
|
|
1507
|
+
| ------------- | -------- |
|
|
1508
|
+
| `description` | `string` |
|
|
1509
|
+
|
|
1510
|
+
##### Returns
|
|
1511
|
+
|
|
1512
|
+
`Promise`\<`void`\>
|
|
1513
|
+
|
|
1514
|
+
##### Inherited from
|
|
1515
|
+
|
|
1516
|
+
`BaseEpub.setDescription`
|
|
1517
|
+
|
|
1518
|
+
#### setLanguage()
|
|
1519
|
+
|
|
1520
|
+
> **setLanguage**(`locale`): `Promise`\<`void`\>
|
|
1521
|
+
|
|
1522
|
+
Defined in:
|
|
1523
|
+
[epub/index.ts:1196](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1196)
|
|
1524
|
+
|
|
1525
|
+
Update the Epub's language metadata entry.
|
|
1526
|
+
|
|
1527
|
+
Updates the existing dc:language element if one exists. Otherwise creates a new
|
|
1528
|
+
element
|
|
1529
|
+
|
|
1530
|
+
##### Parameters
|
|
1531
|
+
|
|
1532
|
+
| Parameter | Type |
|
|
1533
|
+
| --------- | -------- |
|
|
1534
|
+
| `locale` | `Locale` |
|
|
1535
|
+
|
|
1536
|
+
##### Returns
|
|
1537
|
+
|
|
1538
|
+
`Promise`\<`void`\>
|
|
1539
|
+
|
|
1540
|
+
##### Link
|
|
1541
|
+
|
|
1542
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
|
|
1543
|
+
|
|
1544
|
+
##### Inherited from
|
|
1545
|
+
|
|
1546
|
+
`BaseEpub.setLanguage`
|
|
1547
|
+
|
|
1548
|
+
#### setPackageVocabularyPrefix()
|
|
1549
|
+
|
|
1550
|
+
> **setPackageVocabularyPrefix**(`prefix`, `uri`): `Promise`\<`void`\>
|
|
1551
|
+
|
|
1552
|
+
Defined in:
|
|
1553
|
+
[epub/index.ts:1366](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1366)
|
|
1554
|
+
|
|
1555
|
+
Set a custom vocabulary prefix on the root package element.
|
|
1556
|
+
|
|
1557
|
+
##### Parameters
|
|
1558
|
+
|
|
1559
|
+
| Parameter | Type |
|
|
1560
|
+
| --------- | -------- |
|
|
1561
|
+
| `prefix` | `string` |
|
|
1562
|
+
| `uri` | `string` |
|
|
1563
|
+
|
|
1564
|
+
##### Returns
|
|
1565
|
+
|
|
1566
|
+
`Promise`\<`void`\>
|
|
1567
|
+
|
|
1568
|
+
##### Link
|
|
1569
|
+
|
|
1570
|
+
https://www.w3.org/TR/epub-33/#sec-prefix-attr
|
|
1571
|
+
|
|
1572
|
+
##### Inherited from
|
|
1573
|
+
|
|
1574
|
+
`BaseEpub.setPackageVocabularyPrefix`
|
|
1575
|
+
|
|
1576
|
+
#### setPublicationDate()
|
|
1577
|
+
|
|
1578
|
+
> **setPublicationDate**(`date`): `Promise`\<`void`\>
|
|
1579
|
+
|
|
1580
|
+
Defined in:
|
|
1581
|
+
[epub/index.ts:1007](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1007)
|
|
1582
|
+
|
|
1583
|
+
Set the dc:date metadata element with the provided date.
|
|
1584
|
+
|
|
1585
|
+
Updates the existing dc:date element if one exists. Otherwise creates a new
|
|
1586
|
+
element
|
|
1587
|
+
|
|
1588
|
+
##### Parameters
|
|
1589
|
+
|
|
1590
|
+
| Parameter | Type |
|
|
1591
|
+
| --------- | ------ |
|
|
1592
|
+
| `date` | `Date` |
|
|
1593
|
+
|
|
1594
|
+
##### Returns
|
|
1595
|
+
|
|
1596
|
+
`Promise`\<`void`\>
|
|
1597
|
+
|
|
1598
|
+
##### Link
|
|
1599
|
+
|
|
1600
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dcdate
|
|
1601
|
+
|
|
1602
|
+
##### Inherited from
|
|
1603
|
+
|
|
1604
|
+
`BaseEpub.setPublicationDate`
|
|
1605
|
+
|
|
1606
|
+
#### setTitle()
|
|
1607
|
+
|
|
1608
|
+
> **setTitle**(`title`): `Promise`\<`void`\>
|
|
1609
|
+
|
|
1610
|
+
Defined in:
|
|
1611
|
+
[epub/index.ts:1390](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1390)
|
|
1612
|
+
|
|
1613
|
+
Set the title of the Epub.
|
|
1614
|
+
|
|
1615
|
+
This will replace all existing dc:title elements with this title. It will be
|
|
1616
|
+
given title-type "main".
|
|
1617
|
+
|
|
1618
|
+
To set specific titles and their types, use epub.setTitles().
|
|
1619
|
+
|
|
1620
|
+
##### Parameters
|
|
1621
|
+
|
|
1622
|
+
| Parameter | Type |
|
|
1623
|
+
| --------- | -------- |
|
|
1624
|
+
| `title` | `string` |
|
|
1625
|
+
|
|
1626
|
+
##### Returns
|
|
1627
|
+
|
|
1628
|
+
`Promise`\<`void`\>
|
|
1629
|
+
|
|
1630
|
+
##### Link
|
|
1631
|
+
|
|
1632
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
1633
|
+
|
|
1634
|
+
##### Inherited from
|
|
1635
|
+
|
|
1636
|
+
`BaseEpub.setTitle`
|
|
1637
|
+
|
|
1638
|
+
#### setTitles()
|
|
1639
|
+
|
|
1640
|
+
> **setTitles**(`entries`): `Promise`\<`void`\>
|
|
1641
|
+
|
|
1642
|
+
Defined in:
|
|
1643
|
+
[epub/index.ts:1418](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1418)
|
|
1644
|
+
|
|
1645
|
+
##### Parameters
|
|
1646
|
+
|
|
1647
|
+
| Parameter | Type |
|
|
1648
|
+
| --------- | ---------- |
|
|
1649
|
+
| `entries` | `object`[] |
|
|
1650
|
+
|
|
1651
|
+
##### Returns
|
|
1652
|
+
|
|
1653
|
+
`Promise`\<`void`\>
|
|
1654
|
+
|
|
1655
|
+
##### Inherited from
|
|
1656
|
+
|
|
1657
|
+
`BaseEpub.setTitles`
|
|
1658
|
+
|
|
1659
|
+
#### setType()
|
|
1660
|
+
|
|
1661
|
+
> **setType**(`type`): `Promise`\<`void`\>
|
|
1662
|
+
|
|
1663
|
+
Defined in:
|
|
1664
|
+
[epub/index.ts:1023](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1023)
|
|
1665
|
+
|
|
1666
|
+
Set the dc:type metadata element.
|
|
1667
|
+
|
|
1668
|
+
Updates the existing dc:type element if one exists. Otherwise creates a new
|
|
1669
|
+
element.
|
|
1670
|
+
|
|
1671
|
+
##### Parameters
|
|
1672
|
+
|
|
1673
|
+
| Parameter | Type |
|
|
1674
|
+
| --------- | -------- |
|
|
1675
|
+
| `type` | `string` |
|
|
1676
|
+
|
|
1677
|
+
##### Returns
|
|
1678
|
+
|
|
1679
|
+
`Promise`\<`void`\>
|
|
1680
|
+
|
|
1681
|
+
##### Link
|
|
1682
|
+
|
|
1683
|
+
https://www.w3.org/TR/epub-33/#sec-opf-dctype
|
|
1684
|
+
|
|
1685
|
+
##### Inherited from
|
|
1686
|
+
|
|
1687
|
+
`BaseEpub.setType`
|
|
1688
|
+
|
|
1689
|
+
#### updateManifestItem()
|
|
1690
|
+
|
|
1691
|
+
> **updateManifestItem**(`id`, `newItem`): `Promise`\<`void`\>
|
|
1692
|
+
|
|
1693
|
+
Defined in:
|
|
1694
|
+
[epub/index.ts:2268](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2268)
|
|
1695
|
+
|
|
1696
|
+
Update the manifest entry for an existing item.
|
|
1697
|
+
|
|
1698
|
+
To update the contents of an entry, use `epub.writeItemContents()` or
|
|
1699
|
+
`epub.writeXhtmlItemContents()`
|
|
1700
|
+
|
|
1701
|
+
##### Parameters
|
|
1702
|
+
|
|
1703
|
+
| Parameter | Type |
|
|
1704
|
+
| --------- | ------------------------------------------------- |
|
|
1705
|
+
| `id` | `string` |
|
|
1706
|
+
| `newItem` | `Omit`\<[`ManifestItem`](#manifestitem), `"id"`\> |
|
|
1707
|
+
|
|
1708
|
+
##### Returns
|
|
1709
|
+
|
|
1710
|
+
`Promise`\<`void`\>
|
|
1711
|
+
|
|
1712
|
+
##### Link
|
|
1713
|
+
|
|
1714
|
+
https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
1715
|
+
|
|
1716
|
+
##### Inherited from
|
|
1717
|
+
|
|
1718
|
+
`BaseEpub.updateManifestItem`
|
|
1719
|
+
|
|
1720
|
+
#### writeItemContents()
|
|
1721
|
+
|
|
1722
|
+
##### Call Signature
|
|
1723
|
+
|
|
1724
|
+
> **writeItemContents**(`id`, `contents`): `Promise`\<`void`\>
|
|
1725
|
+
|
|
1726
|
+
Defined in:
|
|
1727
|
+
[epub/index.ts:2107](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2107)
|
|
1728
|
+
|
|
1729
|
+
Write new contents for an existing manifest item, specified by its id.
|
|
1730
|
+
|
|
1731
|
+
The id must reference an existing manifest item. If creating a new item, use
|
|
1732
|
+
`epub.addManifestItem()` instead.
|
|
1733
|
+
|
|
1734
|
+
###### Parameters
|
|
1735
|
+
|
|
1736
|
+
| Parameter | Type | Description |
|
|
1737
|
+
| ---------- | ------------ | ----------------------------------------------------------------------------------------------------- |
|
|
1738
|
+
| `id` | `string` | The id of the manifest item to write new contents for |
|
|
1739
|
+
| `contents` | `Uint8Array` | The new contents. May be either a utf-8 encoded string or a byte array, as determined by the encoding |
|
|
1740
|
+
|
|
1741
|
+
###### Returns
|
|
1742
|
+
|
|
1743
|
+
`Promise`\<`void`\>
|
|
1744
|
+
|
|
1745
|
+
###### Link
|
|
1746
|
+
|
|
1747
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
1748
|
+
|
|
1749
|
+
###### Inherited from
|
|
1750
|
+
|
|
1751
|
+
`BaseEpub.writeItemContents`
|
|
1752
|
+
|
|
1753
|
+
##### Call Signature
|
|
1754
|
+
|
|
1755
|
+
> **writeItemContents**(`id`, `contents`, `encoding`): `Promise`\<`void`\>
|
|
1756
|
+
|
|
1757
|
+
Defined in:
|
|
1758
|
+
[epub/index.ts:2108](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2108)
|
|
1759
|
+
|
|
1760
|
+
Write new contents for an existing manifest item, specified by its id.
|
|
1761
|
+
|
|
1762
|
+
The id must reference an existing manifest item. If creating a new item, use
|
|
1763
|
+
`epub.addManifestItem()` instead.
|
|
1764
|
+
|
|
1765
|
+
###### Parameters
|
|
1766
|
+
|
|
1767
|
+
| Parameter | Type | Description |
|
|
1768
|
+
| ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1769
|
+
| `id` | `string` | The id of the manifest item to write new contents for |
|
|
1770
|
+
| `contents` | `string` | The new contents. May be either a utf-8 encoded string or a byte array, as determined by the encoding |
|
|
1771
|
+
| `encoding` | `"utf-8"` | Optional - must be the string "utf-8". If provided, the contents will be interpreted as a unicode string. Otherwise, the contents must be a byte array. |
|
|
1772
|
+
|
|
1773
|
+
###### Returns
|
|
1774
|
+
|
|
1775
|
+
`Promise`\<`void`\>
|
|
1776
|
+
|
|
1777
|
+
###### Link
|
|
1778
|
+
|
|
1779
|
+
https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
1780
|
+
|
|
1781
|
+
###### Inherited from
|
|
1782
|
+
|
|
1783
|
+
`BaseEpub.writeItemContents`
|
|
1784
|
+
|
|
1785
|
+
#### writeToArray()
|
|
1786
|
+
|
|
1787
|
+
> **writeToArray**(): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
1788
|
+
|
|
1789
|
+
Defined in:
|
|
1790
|
+
[epub/index.ts:2438](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2438)
|
|
1791
|
+
|
|
1792
|
+
Write the current contents of the Epub to a new Uint8Array.
|
|
1793
|
+
|
|
1794
|
+
This _does not_ close the Epub. It can continue to be modified after it has been
|
|
1795
|
+
written to disk. Use `epub.close()` to close the Epub.
|
|
1796
|
+
|
|
1797
|
+
When this method is called, the "dcterms:modified" meta tag is automatically
|
|
1798
|
+
updated to the current UTC timestamp.
|
|
1799
|
+
|
|
1800
|
+
##### Returns
|
|
1801
|
+
|
|
1802
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
1803
|
+
|
|
1804
|
+
##### Inherited from
|
|
1805
|
+
|
|
1806
|
+
`BaseEpub.writeToArray`
|
|
1807
|
+
|
|
1808
|
+
#### writeToFile()
|
|
1809
|
+
|
|
1810
|
+
> **writeToFile**(`path`): `Promise`\<`void`\>
|
|
1811
|
+
|
|
1812
|
+
Defined in:
|
|
1813
|
+
[epub/node.ts:56](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/node.ts#L56)
|
|
1814
|
+
|
|
1815
|
+
Write the current contents of the Epub to a new EPUB archive on disk.
|
|
1816
|
+
|
|
1817
|
+
This _does not_ close the Epub. It can continue to be modified after it has been
|
|
1818
|
+
written to disk. Use `epub.close()` to close the Epub.
|
|
1819
|
+
|
|
1820
|
+
When this method is called, the "dcterms:modified" meta tag is automatically
|
|
1821
|
+
updated to the current UTC timestamp.
|
|
1822
|
+
|
|
1823
|
+
##### Parameters
|
|
1824
|
+
|
|
1825
|
+
| Parameter | Type | Description |
|
|
1826
|
+
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
1827
|
+
| `path` | `string` | The file path to write the new archive to. The parent directory does not need te exist -- the path will be recursively created. |
|
|
1828
|
+
|
|
1829
|
+
##### Returns
|
|
1830
|
+
|
|
1831
|
+
`Promise`\<`void`\>
|
|
1832
|
+
|
|
1833
|
+
#### writeXhtmlItemContents()
|
|
1834
|
+
|
|
1835
|
+
> **writeXhtmlItemContents**(`id`, `contents`): `Promise`\<`void`\>
|
|
1836
|
+
|
|
1837
|
+
Defined in:
|
|
1838
|
+
[epub/index.ts:2147](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2147)
|
|
1839
|
+
|
|
1840
|
+
Write new contents for an existing XHTML item, specified by its id.
|
|
1841
|
+
|
|
1842
|
+
The id must reference an existing manifest item. If creating a new item, use
|
|
1843
|
+
`epub.addManifestItem()` instead.
|
|
1844
|
+
|
|
1845
|
+
##### Parameters
|
|
1846
|
+
|
|
1847
|
+
| Parameter | Type | Description |
|
|
1848
|
+
| ---------- | ------------------------- | ----------------------------------------------------- |
|
|
1849
|
+
| `id` | `string` | The id of the manifest item to write new contents for |
|
|
1850
|
+
| `contents` | [`ParsedXml`](#parsedxml) | The new contents. Must be a parsed XML tree. |
|
|
1851
|
+
|
|
1852
|
+
##### Returns
|
|
1853
|
+
|
|
1854
|
+
`Promise`\<`void`\>
|
|
1855
|
+
|
|
1856
|
+
##### Link
|
|
1857
|
+
|
|
1858
|
+
https://www.w3.org/TR/epub-33/#sec-xhtml
|
|
1859
|
+
|
|
1860
|
+
##### Inherited from
|
|
1861
|
+
|
|
1862
|
+
`BaseEpub.writeXhtmlItemContents`
|
|
1863
|
+
|
|
1864
|
+
#### addLinkToXhtmlHead()
|
|
1865
|
+
|
|
1866
|
+
> `static` **addLinkToXhtmlHead**(`xml`, `link`): `void`
|
|
1867
|
+
|
|
1868
|
+
Defined in:
|
|
1869
|
+
[epub/index.ts:272](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L272)
|
|
1870
|
+
|
|
1871
|
+
Given an XML structure representing a complete XHTML document, add a `link`
|
|
1872
|
+
element to the `head` of the document.
|
|
1873
|
+
|
|
1874
|
+
This method modifies the provided XML structure.
|
|
1875
|
+
|
|
1876
|
+
##### Parameters
|
|
1877
|
+
|
|
1878
|
+
| Parameter | Type |
|
|
1879
|
+
| ----------- | ---------------------------------------------------------- |
|
|
1880
|
+
| `xml` | [`ParsedXml`](#parsedxml) |
|
|
1881
|
+
| `link` | \{ `href`: `string`; `rel`: `string`; `type`: `string`; \} |
|
|
1882
|
+
| `link.href` | `string` |
|
|
1883
|
+
| `link.rel` | `string` |
|
|
1884
|
+
| `link.type` | `string` |
|
|
1885
|
+
|
|
1886
|
+
##### Returns
|
|
1887
|
+
|
|
1888
|
+
`void`
|
|
1889
|
+
|
|
1890
|
+
##### Inherited from
|
|
1891
|
+
|
|
1892
|
+
`BaseEpub.addLinkToXhtmlHead`
|
|
1893
|
+
|
|
1894
|
+
#### create()
|
|
1895
|
+
|
|
1896
|
+
> `static` **create**(...`args`): `Promise`\<[`Epub`](#epub)\>
|
|
1897
|
+
|
|
1898
|
+
Defined in:
|
|
1899
|
+
[epub/node.ts:25](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/node.ts#L25)
|
|
1900
|
+
|
|
1901
|
+
Construct an Epub instance, optionally beginning with the provided metadata.
|
|
1902
|
+
|
|
1903
|
+
##### Parameters
|
|
1904
|
+
|
|
1905
|
+
| Parameter | Type |
|
|
1906
|
+
| --------- | ---------------------------------------------------------------- |
|
|
1907
|
+
| ...`args` | \[[`DublinCore`](#dublincore), [`EpubMetadata`](#epubmetadata)\] |
|
|
1908
|
+
|
|
1909
|
+
##### Returns
|
|
1910
|
+
|
|
1911
|
+
`Promise`\<[`Epub`](#epub)\>
|
|
1912
|
+
|
|
1913
|
+
##### Overrides
|
|
1914
|
+
|
|
1915
|
+
`BaseEpub.create`
|
|
1916
|
+
|
|
1917
|
+
#### createXmlElement()
|
|
1918
|
+
|
|
1919
|
+
> `static` **createXmlElement**\<`Name`\>(`name`, `properties`, `children`):
|
|
1920
|
+
> [`XmlElement`](#xmlelement)\<`Name`\>
|
|
1921
|
+
|
|
1922
|
+
Defined in:
|
|
1923
|
+
[epub/index.ts:307](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L307)
|
|
1924
|
+
|
|
1925
|
+
##### Type Parameters
|
|
1926
|
+
|
|
1927
|
+
| Type Parameter |
|
|
1928
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1929
|
+
| `Name` _extends_ `` `a${string}` `` \| `` `b${string}` `` \| `` `c${string}` `` \| `` `d${string}` `` \| `` `e${string}` `` \| `` `f${string}` `` \| `` `g${string}` `` \| `` `h${string}` `` \| `` `i${string}` `` \| `` `j${string}` `` \| `` `k${string}` `` \| `` `l${string}` `` \| `` `m${string}` `` \| `` `n${string}` `` \| `` `o${string}` `` \| `` `p${string}` `` \| `` `q${string}` `` \| `` `r${string}` `` \| `` `s${string}` `` \| `` `t${string}` `` \| `` `u${string}` `` \| `` `v${string}` `` \| `` `w${string}` `` \| `` `x${string}` `` \| `` `y${string}` `` \| `` `z${string}` `` \| `` `A${string}` `` \| `` `B${string}` `` \| `` `C${string}` `` \| `` `D${string}` `` \| `` `E${string}` `` \| `` `F${string}` `` \| `` `G${string}` `` \| `` `H${string}` `` \| `` `I${string}` `` \| `` `J${string}` `` \| `` `K${string}` `` \| `` `L${string}` `` \| `` `M${string}` `` \| `` `N${string}` `` \| `` `O${string}` `` \| `` `P${string}` `` \| `` `Q${string}` `` \| `` `R${string}` `` \| `` `S${string}` `` \| `` `T${string}` `` \| `` `U${string}` `` \| `` `V${string}` `` \| `` `W${string}` `` \| `` `X${string}` `` \| `` `Y${string}` `` \| `` `Z${string}` `` \| `` `?${string}` `` |
|
|
1930
|
+
|
|
1931
|
+
##### Parameters
|
|
1932
|
+
|
|
1933
|
+
| Parameter | Type | Default value |
|
|
1934
|
+
| ------------ | ------------------------------ | ------------- |
|
|
1935
|
+
| `name` | `Name` | `undefined` |
|
|
1936
|
+
| `properties` | `Record`\<`string`, `string`\> | `undefined` |
|
|
1937
|
+
| `children` | [`XmlNode`](#xmlnode)[] | `[]` |
|
|
1938
|
+
|
|
1939
|
+
##### Returns
|
|
1940
|
+
|
|
1941
|
+
[`XmlElement`](#xmlelement)\<`Name`\>
|
|
1942
|
+
|
|
1943
|
+
##### Inherited from
|
|
1944
|
+
|
|
1945
|
+
`BaseEpub.createXmlElement`
|
|
1946
|
+
|
|
1947
|
+
#### createXmlTextNode()
|
|
1948
|
+
|
|
1949
|
+
> `static` **createXmlTextNode**(`text`): [`XmlTextNode`](#xmltextnode)
|
|
1950
|
+
|
|
1951
|
+
Defined in:
|
|
1952
|
+
[epub/index.ts:320](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L320)
|
|
1953
|
+
|
|
1954
|
+
##### Parameters
|
|
1955
|
+
|
|
1956
|
+
| Parameter | Type |
|
|
1957
|
+
| --------- | -------- |
|
|
1958
|
+
| `text` | `string` |
|
|
1959
|
+
|
|
1960
|
+
##### Returns
|
|
1961
|
+
|
|
1962
|
+
[`XmlTextNode`](#xmltextnode)
|
|
1963
|
+
|
|
1964
|
+
##### Inherited from
|
|
1965
|
+
|
|
1966
|
+
`BaseEpub.createXmlTextNode`
|
|
1967
|
+
|
|
1968
|
+
#### findXmlChildByName()
|
|
1969
|
+
|
|
1970
|
+
> `static` **findXmlChildByName**\<`Name`\>(`name`, `xml`, `filter?`):
|
|
1971
|
+
> `undefined` \| [`XmlElement`](#xmlelement)\<`Name`\>
|
|
1972
|
+
|
|
1973
|
+
Defined in:
|
|
1974
|
+
[epub/index.ts:381](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L381)
|
|
1975
|
+
|
|
1976
|
+
Given an XML structure, find the first child matching the provided name and
|
|
1977
|
+
optional filter.
|
|
1978
|
+
|
|
1979
|
+
##### Type Parameters
|
|
1980
|
+
|
|
1981
|
+
| Type Parameter |
|
|
1982
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1983
|
+
| `Name` _extends_ `` `a${string}` `` \| `` `b${string}` `` \| `` `c${string}` `` \| `` `d${string}` `` \| `` `e${string}` `` \| `` `f${string}` `` \| `` `g${string}` `` \| `` `h${string}` `` \| `` `i${string}` `` \| `` `j${string}` `` \| `` `k${string}` `` \| `` `l${string}` `` \| `` `m${string}` `` \| `` `n${string}` `` \| `` `o${string}` `` \| `` `p${string}` `` \| `` `q${string}` `` \| `` `r${string}` `` \| `` `s${string}` `` \| `` `t${string}` `` \| `` `u${string}` `` \| `` `v${string}` `` \| `` `w${string}` `` \| `` `x${string}` `` \| `` `y${string}` `` \| `` `z${string}` `` \| `` `A${string}` `` \| `` `B${string}` `` \| `` `C${string}` `` \| `` `D${string}` `` \| `` `E${string}` `` \| `` `F${string}` `` \| `` `G${string}` `` \| `` `H${string}` `` \| `` `I${string}` `` \| `` `J${string}` `` \| `` `K${string}` `` \| `` `L${string}` `` \| `` `M${string}` `` \| `` `N${string}` `` \| `` `O${string}` `` \| `` `P${string}` `` \| `` `Q${string}` `` \| `` `R${string}` `` \| `` `S${string}` `` \| `` `T${string}` `` \| `` `U${string}` `` \| `` `V${string}` `` \| `` `W${string}` `` \| `` `X${string}` `` \| `` `Y${string}` `` \| `` `Z${string}` `` \| `` `?${string}` `` |
|
|
1984
|
+
|
|
1985
|
+
##### Parameters
|
|
1986
|
+
|
|
1987
|
+
| Parameter | Type |
|
|
1988
|
+
| --------- | ------------------------- |
|
|
1989
|
+
| `name` | `Name` |
|
|
1990
|
+
| `xml` | [`ParsedXml`](#parsedxml) |
|
|
1991
|
+
| `filter?` | (`node`) => `boolean` |
|
|
1992
|
+
|
|
1993
|
+
##### Returns
|
|
1994
|
+
|
|
1995
|
+
`undefined` \| [`XmlElement`](#xmlelement)\<`Name`\>
|
|
1996
|
+
|
|
1997
|
+
##### Inherited from
|
|
1998
|
+
|
|
1999
|
+
`BaseEpub.findXmlChildByName`
|
|
2000
|
+
|
|
2001
|
+
#### formatSmilDuration()
|
|
2002
|
+
|
|
2003
|
+
> `static` **formatSmilDuration**(`duration`): `string`
|
|
2004
|
+
|
|
2005
|
+
Defined in:
|
|
2006
|
+
[epub/index.ts:255](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L255)
|
|
2007
|
+
|
|
2008
|
+
Format a duration, provided as a number of seconds, as a SMIL clock value, to be
|
|
2009
|
+
used for Media Overlays.
|
|
2010
|
+
|
|
2011
|
+
##### Parameters
|
|
2012
|
+
|
|
2013
|
+
| Parameter | Type |
|
|
2014
|
+
| ---------- | -------- |
|
|
2015
|
+
| `duration` | `number` |
|
|
2016
|
+
|
|
2017
|
+
##### Returns
|
|
2018
|
+
|
|
2019
|
+
`string`
|
|
2020
|
+
|
|
2021
|
+
##### Link
|
|
2022
|
+
|
|
2023
|
+
https://www.w3.org/TR/epub-33/#sec-duration
|
|
2024
|
+
|
|
2025
|
+
##### Inherited from
|
|
2026
|
+
|
|
2027
|
+
`BaseEpub.formatSmilDuration`
|
|
2028
|
+
|
|
2029
|
+
#### from()
|
|
2030
|
+
|
|
2031
|
+
> `static` **from**(...`args`): `Promise`\<[`Epub`](#epub)\>
|
|
2032
|
+
|
|
2033
|
+
Defined in:
|
|
2034
|
+
[epub/node.ts:31](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/node.ts#L31)
|
|
2035
|
+
|
|
2036
|
+
Construct an Epub instance by reading an existing EPUB publication.
|
|
2037
|
+
|
|
2038
|
+
##### Parameters
|
|
2039
|
+
|
|
2040
|
+
| Parameter | Type |
|
|
2041
|
+
| --------- | ------------------------------------------------- |
|
|
2042
|
+
| ...`args` | \[`string` \| `Uint8Array`\<`ArrayBufferLike`\>\] |
|
|
2043
|
+
|
|
2044
|
+
##### Returns
|
|
2045
|
+
|
|
2046
|
+
`Promise`\<[`Epub`](#epub)\>
|
|
2047
|
+
|
|
2048
|
+
##### Overrides
|
|
2049
|
+
|
|
2050
|
+
`BaseEpub.from`
|
|
2051
|
+
|
|
2052
|
+
#### getXhtmlBody()
|
|
2053
|
+
|
|
2054
|
+
> `static` **getXhtmlBody**(`xml`): [`ParsedXml`](#parsedxml)
|
|
2055
|
+
|
|
2056
|
+
Defined in:
|
|
2057
|
+
[epub/index.ts:297](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L297)
|
|
2058
|
+
|
|
2059
|
+
Given an XML structure representing a complete XHTML document, return the
|
|
2060
|
+
sub-structure representing the children of the document's body element.
|
|
2061
|
+
|
|
2062
|
+
##### Parameters
|
|
2063
|
+
|
|
2064
|
+
| Parameter | Type |
|
|
2065
|
+
| --------- | ------------------------- |
|
|
2066
|
+
| `xml` | [`ParsedXml`](#parsedxml) |
|
|
2067
|
+
|
|
2068
|
+
##### Returns
|
|
2069
|
+
|
|
2070
|
+
[`ParsedXml`](#parsedxml)
|
|
2071
|
+
|
|
2072
|
+
##### Inherited from
|
|
2073
|
+
|
|
2074
|
+
`BaseEpub.getXhtmlBody`
|
|
2075
|
+
|
|
2076
|
+
#### getXhtmlTextContent()
|
|
2077
|
+
|
|
2078
|
+
> `static` **getXhtmlTextContent**(`xml`): `string`
|
|
2079
|
+
|
|
2080
|
+
Defined in:
|
|
2081
|
+
[epub/index.ts:329](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L329)
|
|
2082
|
+
|
|
2083
|
+
Given an XML structure representing a complete XHTML document, return a string
|
|
2084
|
+
representing the concatenation of all text nodes in the document.
|
|
2085
|
+
|
|
2086
|
+
##### Parameters
|
|
2087
|
+
|
|
2088
|
+
| Parameter | Type |
|
|
2089
|
+
| --------- | ------------------------- |
|
|
2090
|
+
| `xml` | [`ParsedXml`](#parsedxml) |
|
|
2091
|
+
|
|
2092
|
+
##### Returns
|
|
2093
|
+
|
|
2094
|
+
`string`
|
|
2095
|
+
|
|
2096
|
+
##### Inherited from
|
|
2097
|
+
|
|
2098
|
+
`BaseEpub.getXhtmlTextContent`
|
|
2099
|
+
|
|
2100
|
+
#### getXmlChildren()
|
|
2101
|
+
|
|
2102
|
+
> `static` **getXmlChildren**\<`Name`\>(`element`): [`ParsedXml`](#parsedxml)
|
|
2103
|
+
|
|
2104
|
+
Defined in:
|
|
2105
|
+
[epub/index.ts:361](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L361)
|
|
2106
|
+
|
|
2107
|
+
Given an XMLElement, return a list of its children
|
|
2108
|
+
|
|
2109
|
+
##### Type Parameters
|
|
2110
|
+
|
|
2111
|
+
| Type Parameter |
|
|
2112
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2113
|
+
| `Name` _extends_ `` `a${string}` `` \| `` `b${string}` `` \| `` `c${string}` `` \| `` `d${string}` `` \| `` `e${string}` `` \| `` `f${string}` `` \| `` `g${string}` `` \| `` `h${string}` `` \| `` `i${string}` `` \| `` `j${string}` `` \| `` `k${string}` `` \| `` `l${string}` `` \| `` `m${string}` `` \| `` `n${string}` `` \| `` `o${string}` `` \| `` `p${string}` `` \| `` `q${string}` `` \| `` `r${string}` `` \| `` `s${string}` `` \| `` `t${string}` `` \| `` `u${string}` `` \| `` `v${string}` `` \| `` `w${string}` `` \| `` `x${string}` `` \| `` `y${string}` `` \| `` `z${string}` `` \| `` `A${string}` `` \| `` `B${string}` `` \| `` `C${string}` `` \| `` `D${string}` `` \| `` `E${string}` `` \| `` `F${string}` `` \| `` `G${string}` `` \| `` `H${string}` `` \| `` `I${string}` `` \| `` `J${string}` `` \| `` `K${string}` `` \| `` `L${string}` `` \| `` `M${string}` `` \| `` `N${string}` `` \| `` `O${string}` `` \| `` `P${string}` `` \| `` `Q${string}` `` \| `` `R${string}` `` \| `` `S${string}` `` \| `` `T${string}` `` \| `` `U${string}` `` \| `` `V${string}` `` \| `` `W${string}` `` \| `` `X${string}` `` \| `` `Y${string}` `` \| `` `Z${string}` `` \| `` `?${string}` `` |
|
|
2114
|
+
|
|
2115
|
+
##### Parameters
|
|
2116
|
+
|
|
2117
|
+
| Parameter | Type |
|
|
2118
|
+
| --------- | ------------------------------------- |
|
|
2119
|
+
| `element` | [`XmlElement`](#xmlelement)\<`Name`\> |
|
|
2120
|
+
|
|
2121
|
+
##### Returns
|
|
2122
|
+
|
|
2123
|
+
[`ParsedXml`](#parsedxml)
|
|
2124
|
+
|
|
2125
|
+
##### Inherited from
|
|
2126
|
+
|
|
2127
|
+
`BaseEpub.getXmlChildren`
|
|
2128
|
+
|
|
2129
|
+
#### getXmlElementName()
|
|
2130
|
+
|
|
2131
|
+
> `static` **getXmlElementName**\<`Name`\>(`element`): `Name`
|
|
2132
|
+
|
|
2133
|
+
Defined in:
|
|
2134
|
+
[epub/index.ts:346](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L346)
|
|
2135
|
+
|
|
2136
|
+
Given an XMLElement, return its tag name.
|
|
2137
|
+
|
|
2138
|
+
##### Type Parameters
|
|
2139
|
+
|
|
2140
|
+
| Type Parameter |
|
|
2141
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2142
|
+
| `Name` _extends_ `` `a${string}` `` \| `` `b${string}` `` \| `` `c${string}` `` \| `` `d${string}` `` \| `` `e${string}` `` \| `` `f${string}` `` \| `` `g${string}` `` \| `` `h${string}` `` \| `` `i${string}` `` \| `` `j${string}` `` \| `` `k${string}` `` \| `` `l${string}` `` \| `` `m${string}` `` \| `` `n${string}` `` \| `` `o${string}` `` \| `` `p${string}` `` \| `` `q${string}` `` \| `` `r${string}` `` \| `` `s${string}` `` \| `` `t${string}` `` \| `` `u${string}` `` \| `` `v${string}` `` \| `` `w${string}` `` \| `` `x${string}` `` \| `` `y${string}` `` \| `` `z${string}` `` \| `` `A${string}` `` \| `` `B${string}` `` \| `` `C${string}` `` \| `` `D${string}` `` \| `` `E${string}` `` \| `` `F${string}` `` \| `` `G${string}` `` \| `` `H${string}` `` \| `` `I${string}` `` \| `` `J${string}` `` \| `` `K${string}` `` \| `` `L${string}` `` \| `` `M${string}` `` \| `` `N${string}` `` \| `` `O${string}` `` \| `` `P${string}` `` \| `` `Q${string}` `` \| `` `R${string}` `` \| `` `S${string}` `` \| `` `T${string}` `` \| `` `U${string}` `` \| `` `V${string}` `` \| `` `W${string}` `` \| `` `X${string}` `` \| `` `Y${string}` `` \| `` `Z${string}` `` \| `` `?${string}` `` |
|
|
2143
|
+
|
|
2144
|
+
##### Parameters
|
|
2145
|
+
|
|
2146
|
+
| Parameter | Type |
|
|
2147
|
+
| --------- | ------------------------------------- |
|
|
2148
|
+
| `element` | [`XmlElement`](#xmlelement)\<`Name`\> |
|
|
2149
|
+
|
|
2150
|
+
##### Returns
|
|
2151
|
+
|
|
2152
|
+
`Name`
|
|
2153
|
+
|
|
2154
|
+
##### Inherited from
|
|
2155
|
+
|
|
2156
|
+
`BaseEpub.getXmlElementName`
|
|
2157
|
+
|
|
2158
|
+
#### isXmlTextNode()
|
|
2159
|
+
|
|
2160
|
+
> `static` **isXmlTextNode**(`node`): `node is XmlTextNode`
|
|
2161
|
+
|
|
2162
|
+
Defined in:
|
|
2163
|
+
[epub/index.ts:394](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L394)
|
|
2164
|
+
|
|
2165
|
+
Given an XMLNode, determine whether it represents a text node or an XML element.
|
|
2166
|
+
|
|
2167
|
+
##### Parameters
|
|
2168
|
+
|
|
2169
|
+
| Parameter | Type |
|
|
2170
|
+
| --------- | --------------------- |
|
|
2171
|
+
| `node` | [`XmlNode`](#xmlnode) |
|
|
2172
|
+
|
|
2173
|
+
##### Returns
|
|
2174
|
+
|
|
2175
|
+
`node is XmlTextNode`
|
|
2176
|
+
|
|
2177
|
+
##### Inherited from
|
|
2178
|
+
|
|
2179
|
+
`BaseEpub.isXmlTextNode`
|
|
2180
|
+
|
|
2181
|
+
#### replaceXmlChildren()
|
|
2182
|
+
|
|
2183
|
+
> `static` **replaceXmlChildren**\<`Name`\>(`element`, `children`): `void`
|
|
2184
|
+
|
|
2185
|
+
Defined in:
|
|
2186
|
+
[epub/index.ts:369](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L369)
|
|
2187
|
+
|
|
2188
|
+
##### Type Parameters
|
|
2189
|
+
|
|
2190
|
+
| Type Parameter |
|
|
2191
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
2192
|
+
| `Name` _extends_ `` `a${string}` `` \| `` `b${string}` `` \| `` `c${string}` `` \| `` `d${string}` `` \| `` `e${string}` `` \| `` `f${string}` `` \| `` `g${string}` `` \| `` `h${string}` `` \| `` `i${string}` `` \| `` `j${string}` `` \| `` `k${string}` `` \| `` `l${string}` `` \| `` `m${string}` `` \| `` `n${string}` `` \| `` `o${string}` `` \| `` `p${string}` `` \| `` `q${string}` `` \| `` `r${string}` `` \| `` `s${string}` `` \| `` `t${string}` `` \| `` `u${string}` `` \| `` `v${string}` `` \| `` `w${string}` `` \| `` `x${string}` `` \| `` `y${string}` `` \| `` `z${string}` `` \| `` `A${string}` `` \| `` `B${string}` `` \| `` `C${string}` `` \| `` `D${string}` `` \| `` `E${string}` `` \| `` `F${string}` `` \| `` `G${string}` `` \| `` `H${string}` `` \| `` `I${string}` `` \| `` `J${string}` `` \| `` `K${string}` `` \| `` `L${string}` `` \| `` `M${string}` `` \| `` `N${string}` `` \| `` `O${string}` `` \| `` `P${string}` `` \| `` `Q${string}` `` \| `` `R${string}` `` \| `` `S${string}` `` \| `` `T${string}` `` \| `` `U${string}` `` \| `` `V${string}` `` \| `` `W${string}` `` \| `` `X${string}` `` \| `` `Y${string}` `` \| `` `Z${string}` `` \| `` `?${string}` `` |
|
|
2193
|
+
|
|
2194
|
+
##### Parameters
|
|
2195
|
+
|
|
2196
|
+
| Parameter | Type |
|
|
2197
|
+
| ---------- | ------------------------------------- |
|
|
2198
|
+
| `element` | [`XmlElement`](#xmlelement)\<`Name`\> |
|
|
2199
|
+
| `children` | [`XmlNode`](#xmlnode)[] |
|
|
2200
|
+
|
|
2201
|
+
##### Returns
|
|
2202
|
+
|
|
2203
|
+
`void`
|
|
2204
|
+
|
|
2205
|
+
##### Inherited from
|
|
2206
|
+
|
|
2207
|
+
`BaseEpub.replaceXmlChildren`
|
|
2208
|
+
|
|
2209
|
+
---
|
|
2210
|
+
|
|
2211
|
+
## AlternateScript
|
|
2212
|
+
|
|
2213
|
+
Defined in:
|
|
2214
|
+
[epub/index.ts:143](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L143)
|
|
2215
|
+
|
|
2216
|
+
### Properties
|
|
2217
|
+
|
|
2218
|
+
#### locale
|
|
2219
|
+
|
|
2220
|
+
> **locale**: `Locale`
|
|
2221
|
+
|
|
2222
|
+
Defined in:
|
|
2223
|
+
[epub/index.ts:145](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L145)
|
|
2224
|
+
|
|
2225
|
+
#### name
|
|
2226
|
+
|
|
2227
|
+
> **name**: `string`
|
|
2228
|
+
|
|
2229
|
+
Defined in:
|
|
2230
|
+
[epub/index.ts:144](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L144)
|
|
2231
|
+
|
|
2232
|
+
---
|
|
2233
|
+
|
|
2234
|
+
## Collection
|
|
2235
|
+
|
|
2236
|
+
Defined in:
|
|
2237
|
+
[epub/index.ts:167](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L167)
|
|
2238
|
+
|
|
2239
|
+
### Properties
|
|
2240
|
+
|
|
2241
|
+
#### name
|
|
2242
|
+
|
|
2243
|
+
> **name**: `string`
|
|
2244
|
+
|
|
2245
|
+
Defined in:
|
|
2246
|
+
[epub/index.ts:168](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L168)
|
|
2247
|
+
|
|
2248
|
+
#### position?
|
|
2249
|
+
|
|
2250
|
+
> `optional` **position**: `string`
|
|
2251
|
+
|
|
2252
|
+
Defined in:
|
|
2253
|
+
[epub/index.ts:170](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L170)
|
|
2254
|
+
|
|
2255
|
+
#### type?
|
|
2256
|
+
|
|
2257
|
+
> `optional` **type**: `string`
|
|
2258
|
+
|
|
2259
|
+
Defined in:
|
|
2260
|
+
[epub/index.ts:169](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L169)
|
|
2261
|
+
|
|
2262
|
+
---
|
|
2263
|
+
|
|
2264
|
+
## DcCreator
|
|
2265
|
+
|
|
2266
|
+
Defined in:
|
|
2267
|
+
[epub/index.ts:148](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L148)
|
|
2268
|
+
|
|
2269
|
+
### Properties
|
|
2270
|
+
|
|
2271
|
+
#### alternateScripts?
|
|
2272
|
+
|
|
2273
|
+
> `optional` **alternateScripts**: [`AlternateScript`](#alternatescript)[]
|
|
2274
|
+
|
|
2275
|
+
Defined in:
|
|
2276
|
+
[epub/index.ts:153](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L153)
|
|
2277
|
+
|
|
2278
|
+
#### fileAs?
|
|
2279
|
+
|
|
2280
|
+
> `optional` **fileAs**: `string`
|
|
2281
|
+
|
|
2282
|
+
Defined in:
|
|
2283
|
+
[epub/index.ts:152](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L152)
|
|
2284
|
+
|
|
2285
|
+
#### name
|
|
2286
|
+
|
|
2287
|
+
> **name**: `string`
|
|
2288
|
+
|
|
2289
|
+
Defined in:
|
|
2290
|
+
[epub/index.ts:149](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L149)
|
|
2291
|
+
|
|
2292
|
+
#### role?
|
|
2293
|
+
|
|
2294
|
+
> `optional` **role**: `string`
|
|
2295
|
+
|
|
2296
|
+
Defined in:
|
|
2297
|
+
[epub/index.ts:150](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L150)
|
|
2298
|
+
|
|
2299
|
+
#### roleScheme?
|
|
2300
|
+
|
|
2301
|
+
> `optional` **roleScheme**: `string`
|
|
2302
|
+
|
|
2303
|
+
Defined in:
|
|
2304
|
+
[epub/index.ts:151](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L151)
|
|
2305
|
+
|
|
2306
|
+
---
|
|
2307
|
+
|
|
2308
|
+
## DcSubject
|
|
2309
|
+
|
|
2310
|
+
Defined in:
|
|
2311
|
+
[epub/index.ts:137](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L137)
|
|
2312
|
+
|
|
2313
|
+
### Properties
|
|
2314
|
+
|
|
2315
|
+
#### authority
|
|
2316
|
+
|
|
2317
|
+
> **authority**: `string`
|
|
2318
|
+
|
|
2319
|
+
Defined in:
|
|
2320
|
+
[epub/index.ts:139](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L139)
|
|
2321
|
+
|
|
2322
|
+
#### term
|
|
2323
|
+
|
|
2324
|
+
> **term**: `string`
|
|
2325
|
+
|
|
2326
|
+
Defined in:
|
|
2327
|
+
[epub/index.ts:140](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L140)
|
|
2328
|
+
|
|
2329
|
+
#### value
|
|
2330
|
+
|
|
2331
|
+
> **value**: `string`
|
|
2332
|
+
|
|
2333
|
+
Defined in:
|
|
2334
|
+
[epub/index.ts:138](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L138)
|
|
2335
|
+
|
|
2336
|
+
---
|
|
2337
|
+
|
|
2338
|
+
## DublinCore
|
|
2339
|
+
|
|
2340
|
+
Defined in:
|
|
2341
|
+
[epub/index.ts:156](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L156)
|
|
2342
|
+
|
|
2343
|
+
### Properties
|
|
2344
|
+
|
|
2345
|
+
#### contributors?
|
|
2346
|
+
|
|
2347
|
+
> `optional` **contributors**: [`DcCreator`](#dccreator)[]
|
|
2348
|
+
|
|
2349
|
+
Defined in:
|
|
2350
|
+
[epub/index.ts:163](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L163)
|
|
2351
|
+
|
|
2352
|
+
#### creators?
|
|
2353
|
+
|
|
2354
|
+
> `optional` **creators**: [`DcCreator`](#dccreator)[]
|
|
2355
|
+
|
|
2356
|
+
Defined in:
|
|
2357
|
+
[epub/index.ts:162](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L162)
|
|
2358
|
+
|
|
2359
|
+
#### date?
|
|
2360
|
+
|
|
2361
|
+
> `optional` **date**: `Date`
|
|
2362
|
+
|
|
2363
|
+
Defined in:
|
|
2364
|
+
[epub/index.ts:160](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L160)
|
|
2365
|
+
|
|
2366
|
+
#### identifier
|
|
2367
|
+
|
|
2368
|
+
> **identifier**: `string`
|
|
2369
|
+
|
|
2370
|
+
Defined in:
|
|
2371
|
+
[epub/index.ts:159](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L159)
|
|
2372
|
+
|
|
2373
|
+
#### language
|
|
2374
|
+
|
|
2375
|
+
> **language**: `Locale`
|
|
2376
|
+
|
|
2377
|
+
Defined in:
|
|
2378
|
+
[epub/index.ts:158](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L158)
|
|
2379
|
+
|
|
2380
|
+
#### subjects?
|
|
2381
|
+
|
|
2382
|
+
> `optional` **subjects**: (`string` \| [`DcSubject`](#dcsubject))[]
|
|
2383
|
+
|
|
2384
|
+
Defined in:
|
|
2385
|
+
[epub/index.ts:161](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L161)
|
|
2386
|
+
|
|
2387
|
+
#### title
|
|
2388
|
+
|
|
2389
|
+
> **title**: `string`
|
|
2390
|
+
|
|
2391
|
+
Defined in:
|
|
2392
|
+
[epub/index.ts:157](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L157)
|
|
2393
|
+
|
|
2394
|
+
#### type?
|
|
2395
|
+
|
|
2396
|
+
> `optional` **type**: `string`
|
|
2397
|
+
|
|
2398
|
+
Defined in:
|
|
2399
|
+
[epub/index.ts:164](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L164)
|
|
2400
|
+
|
|
2401
|
+
---
|
|
2402
|
+
|
|
2403
|
+
## ElementName
|
|
2404
|
+
|
|
2405
|
+
> **ElementName** =
|
|
2406
|
+
> \`$\{Letter \| Uppercase\<Letter\> \| QuestionMark\}$\{string\}\`
|
|
2407
|
+
|
|
2408
|
+
Defined in:
|
|
2409
|
+
[epub/index.ts:64](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L64)
|
|
2410
|
+
|
|
2411
|
+
A valid name for an XML element (must start with a letter)
|
|
2412
|
+
|
|
2413
|
+
---
|
|
2414
|
+
|
|
2415
|
+
## EpubMetadata
|
|
2416
|
+
|
|
2417
|
+
> **EpubMetadata** = [`MetadataEntry`](#metadataentry)[]
|
|
2418
|
+
|
|
2419
|
+
Defined in:
|
|
2420
|
+
[epub/index.ts:135](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L135)
|
|
2421
|
+
|
|
2422
|
+
---
|
|
2423
|
+
|
|
2424
|
+
## ManifestItem
|
|
2425
|
+
|
|
2426
|
+
> **ManifestItem** = `object`
|
|
2427
|
+
|
|
2428
|
+
Defined in:
|
|
2429
|
+
[epub/index.ts:85](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L85)
|
|
2430
|
+
|
|
2431
|
+
### Properties
|
|
2432
|
+
|
|
2433
|
+
#### fallback?
|
|
2434
|
+
|
|
2435
|
+
> `optional` **fallback**: `string`
|
|
2436
|
+
|
|
2437
|
+
Defined in:
|
|
2438
|
+
[epub/index.ts:89](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L89)
|
|
2439
|
+
|
|
2440
|
+
#### href
|
|
2441
|
+
|
|
2442
|
+
> **href**: `string`
|
|
2443
|
+
|
|
2444
|
+
Defined in:
|
|
2445
|
+
[epub/index.ts:87](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L87)
|
|
2446
|
+
|
|
2447
|
+
#### id
|
|
2448
|
+
|
|
2449
|
+
> **id**: `string`
|
|
2450
|
+
|
|
2451
|
+
Defined in:
|
|
2452
|
+
[epub/index.ts:86](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L86)
|
|
2453
|
+
|
|
2454
|
+
#### mediaOverlay?
|
|
2455
|
+
|
|
2456
|
+
> `optional` **mediaOverlay**: `string`
|
|
2457
|
+
|
|
2458
|
+
Defined in:
|
|
2459
|
+
[epub/index.ts:90](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L90)
|
|
2460
|
+
|
|
2461
|
+
#### mediaType?
|
|
2462
|
+
|
|
2463
|
+
> `optional` **mediaType**: `string`
|
|
2464
|
+
|
|
2465
|
+
Defined in:
|
|
2466
|
+
[epub/index.ts:88](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L88)
|
|
2467
|
+
|
|
2468
|
+
#### properties?
|
|
2469
|
+
|
|
2470
|
+
> `optional` **properties**: `string`[]
|
|
2471
|
+
|
|
2472
|
+
Defined in:
|
|
2473
|
+
[epub/index.ts:91](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L91)
|
|
2474
|
+
|
|
2475
|
+
---
|
|
2476
|
+
|
|
2477
|
+
## MetadataEntry
|
|
2478
|
+
|
|
2479
|
+
> **MetadataEntry** = `object`
|
|
2480
|
+
|
|
2481
|
+
Defined in:
|
|
2482
|
+
[epub/index.ts:128](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L128)
|
|
2483
|
+
|
|
2484
|
+
### Properties
|
|
2485
|
+
|
|
2486
|
+
#### id?
|
|
2487
|
+
|
|
2488
|
+
> `optional` **id**: `string`
|
|
2489
|
+
|
|
2490
|
+
Defined in:
|
|
2491
|
+
[epub/index.ts:129](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L129)
|
|
2492
|
+
|
|
2493
|
+
#### properties
|
|
2494
|
+
|
|
2495
|
+
> **properties**: `Record`\<`string`, `string`\>
|
|
2496
|
+
|
|
2497
|
+
Defined in:
|
|
2498
|
+
[epub/index.ts:131](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L131)
|
|
2499
|
+
|
|
2500
|
+
#### type
|
|
2501
|
+
|
|
2502
|
+
> **type**: [`ElementName`](#elementname)
|
|
2503
|
+
|
|
2504
|
+
Defined in:
|
|
2505
|
+
[epub/index.ts:130](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L130)
|
|
2506
|
+
|
|
2507
|
+
#### value
|
|
2508
|
+
|
|
2509
|
+
> **value**: `string` \| `undefined`
|
|
2510
|
+
|
|
2511
|
+
Defined in:
|
|
2512
|
+
[epub/index.ts:132](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L132)
|
|
2513
|
+
|
|
2514
|
+
---
|
|
2515
|
+
|
|
2516
|
+
## ParsedXml
|
|
2517
|
+
|
|
2518
|
+
> **ParsedXml** = [`XmlNode`](#xmlnode)[]
|
|
2519
|
+
|
|
2520
|
+
Defined in:
|
|
2521
|
+
[epub/index.ts:83](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L83)
|
|
2522
|
+
|
|
2523
|
+
An XML structure
|
|
2524
|
+
|
|
2525
|
+
---
|
|
2526
|
+
|
|
2527
|
+
## XmlElement\<Name\>
|
|
2528
|
+
|
|
2529
|
+
> **XmlElement**\<`Name`\> = `object` & `{ [key in Name]: ParsedXml }`
|
|
2530
|
+
|
|
2531
|
+
Defined in:
|
|
2532
|
+
[epub/index.ts:70](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L70)
|
|
2533
|
+
|
|
2534
|
+
An XML element
|
|
2535
|
+
|
|
2536
|
+
### Type declaration
|
|
2537
|
+
|
|
2538
|
+
#### :@?
|
|
2539
|
+
|
|
2540
|
+
> `optional` **:@**: `Record`\<`` `${PropertyPrefix}${string}` ``, `string`\>
|
|
2541
|
+
|
|
2542
|
+
### Type Parameters
|
|
2543
|
+
|
|
2544
|
+
| Type Parameter | Default type |
|
|
2545
|
+
| ---------------------------------------------- | ----------------------------- |
|
|
2546
|
+
| `Name` _extends_ [`ElementName`](#elementname) | [`ElementName`](#elementname) |
|
|
2547
|
+
|
|
2548
|
+
---
|
|
2549
|
+
|
|
2550
|
+
## XmlNode
|
|
2551
|
+
|
|
2552
|
+
> **XmlNode** = [`XmlElement`](#xmlelement) \| [`XmlTextNode`](#xmltextnode)
|
|
2553
|
+
|
|
2554
|
+
Defined in:
|
|
2555
|
+
[epub/index.ts:80](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L80)
|
|
2556
|
+
|
|
2557
|
+
A valid XML node. May be either an element or a text node.
|
|
2558
|
+
|
|
2559
|
+
---
|
|
2560
|
+
|
|
2561
|
+
## XmlTextNode
|
|
2562
|
+
|
|
2563
|
+
> **XmlTextNode** = `object`
|
|
2564
|
+
|
|
2565
|
+
Defined in:
|
|
2566
|
+
[epub/index.ts:77](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L77)
|
|
2567
|
+
|
|
2568
|
+
A text node in an XML document
|
|
2569
|
+
|
|
2570
|
+
### Properties
|
|
2571
|
+
|
|
2572
|
+
#### #text
|
|
2573
|
+
|
|
2574
|
+
> **#text**: `string`
|
|
2575
|
+
|
|
2576
|
+
Defined in:
|
|
2577
|
+
[epub/index.ts:77](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L77)
|