@storyteller-platform/epub 0.5.0 → 0.6.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/README.md +1491 -284
- package/dist/adapters/interface.cjs +16 -0
- package/dist/adapters/interface.d.cts +69 -0
- package/dist/adapters/interface.d.ts +69 -0
- package/dist/adapters/interface.js +0 -0
- package/dist/adapters/memory.cjs +103 -0
- package/dist/adapters/memory.d.cts +37 -0
- package/dist/adapters/memory.d.ts +37 -0
- package/dist/adapters/memory.js +83 -0
- package/dist/adapters/tmpfs.cjs +235 -0
- package/dist/adapters/tmpfs.d.cts +29 -0
- package/dist/adapters/tmpfs.d.ts +29 -0
- package/dist/adapters/tmpfs.js +178 -0
- package/dist/index.cjs +289 -280
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +292 -240
- package/dist/upgrade.d.cts +142 -19
- package/dist/upgrade.d.ts +142 -19
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -220,7 +220,7 @@ To get started with developing in the Storyteller monorepo, check out the
|
|
|
220
220
|
## Epub
|
|
221
221
|
|
|
222
222
|
Defined in:
|
|
223
|
-
[epub/index.ts:
|
|
223
|
+
[epub/index.ts:267](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L267)
|
|
224
224
|
|
|
225
225
|
A single EPUB instance.
|
|
226
226
|
|
|
@@ -259,17 +259,25 @@ https://www.w3.org/TR/epub-33/
|
|
|
259
259
|
|
|
260
260
|
#### Constructor
|
|
261
261
|
|
|
262
|
-
>
|
|
262
|
+
> **new Epub**(`adapterClass`, `adapter`, `inputPath`, `readonlyOverride`):
|
|
263
|
+
> [`Epub`](#epub)
|
|
263
264
|
|
|
264
265
|
Defined in:
|
|
265
|
-
[epub/index.ts:
|
|
266
|
+
[epub/index.ts:533](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L533)
|
|
267
|
+
|
|
268
|
+
Prefer the static factories ([Epub.using](#using), [Epub.from](#from),
|
|
269
|
+
[Epub.create](#create), [Epub.upgrade](#upgrade)) over calling this constructor
|
|
270
|
+
directly. It's public so [EpubFactory](#epubfactory) can construct instances;
|
|
271
|
+
nothing else should need to.
|
|
266
272
|
|
|
267
273
|
##### Parameters
|
|
268
274
|
|
|
269
|
-
| Parameter
|
|
270
|
-
|
|
|
271
|
-
| `
|
|
272
|
-
| `
|
|
275
|
+
| Parameter | Type | Default value |
|
|
276
|
+
| ------------------ | ----------------------------------------------------- | ------------- |
|
|
277
|
+
| `adapterClass` | [`EpubStorageAdapterClass`](#epubstorageadapterclass) | `undefined` |
|
|
278
|
+
| `adapter` | [`EpubStorageAdapter`](#epubstorageadapter) | `undefined` |
|
|
279
|
+
| `inputPath` | `undefined` \| `string` | `undefined` |
|
|
280
|
+
| `readonlyOverride` | `boolean` | `false` |
|
|
273
281
|
|
|
274
282
|
##### Returns
|
|
275
283
|
|
|
@@ -277,47 +285,75 @@ Defined in:
|
|
|
277
285
|
|
|
278
286
|
### Properties
|
|
279
287
|
|
|
280
|
-
####
|
|
288
|
+
#### adapter
|
|
289
|
+
|
|
290
|
+
> `protected` **adapter**: [`EpubStorageAdapter`](#epubstorageadapter)
|
|
291
|
+
|
|
292
|
+
Defined in:
|
|
293
|
+
[epub/index.ts:535](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L535)
|
|
294
|
+
|
|
295
|
+
#### adapterClass
|
|
281
296
|
|
|
282
|
-
> `protected` **
|
|
297
|
+
> `protected` **adapterClass**:
|
|
298
|
+
> [`EpubStorageAdapterClass`](#epubstorageadapterclass)
|
|
283
299
|
|
|
284
300
|
Defined in:
|
|
285
|
-
[epub/index.ts:
|
|
301
|
+
[epub/index.ts:534](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L534)
|
|
286
302
|
|
|
287
303
|
#### inputPath
|
|
288
304
|
|
|
289
305
|
> `protected` **inputPath**: `undefined` \| `string`
|
|
290
306
|
|
|
291
307
|
Defined in:
|
|
292
|
-
[epub/index.ts:
|
|
308
|
+
[epub/index.ts:536](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L536)
|
|
309
|
+
|
|
310
|
+
#### readonlyOverride
|
|
311
|
+
|
|
312
|
+
> `protected` **readonlyOverride**: `boolean` = `false`
|
|
313
|
+
|
|
314
|
+
Defined in:
|
|
315
|
+
[epub/index.ts:537](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L537)
|
|
316
|
+
|
|
317
|
+
#### storage
|
|
318
|
+
|
|
319
|
+
> `readonly` **storage**: [`EpubStorageKind`](#epubstoragekind)
|
|
320
|
+
|
|
321
|
+
Defined in:
|
|
322
|
+
[epub/index.ts:525](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L525)
|
|
323
|
+
|
|
324
|
+
Storage backend kind in use for this instance
|
|
325
|
+
|
|
326
|
+
Public so callers can declare type-level requirements via
|
|
327
|
+
[InMemoryEpubReader](#inmemoryepubreader) Orthogonal to the read-only / writable
|
|
328
|
+
axis (controlled by `readonlyOverride` and the adapter's capability bag)
|
|
293
329
|
|
|
294
330
|
#### xhtmlBuilder
|
|
295
331
|
|
|
296
332
|
> `static` **xhtmlBuilder**: `XMLBuilder`
|
|
297
333
|
|
|
298
334
|
Defined in:
|
|
299
|
-
[epub/index.ts:
|
|
335
|
+
[epub/index.ts:315](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L315)
|
|
300
336
|
|
|
301
337
|
#### xhtmlParser
|
|
302
338
|
|
|
303
339
|
> `static` **xhtmlParser**: `XMLParser`
|
|
304
340
|
|
|
305
341
|
Defined in:
|
|
306
|
-
[epub/index.ts:
|
|
342
|
+
[epub/index.ts:275](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L275)
|
|
307
343
|
|
|
308
344
|
#### xmlBuilder
|
|
309
345
|
|
|
310
346
|
> `static` **xmlBuilder**: `XMLBuilder`
|
|
311
347
|
|
|
312
348
|
Defined in:
|
|
313
|
-
[epub/index.ts:
|
|
349
|
+
[epub/index.ts:308](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L308)
|
|
314
350
|
|
|
315
351
|
#### xmlParser
|
|
316
352
|
|
|
317
353
|
> `static` **xmlParser**: `XMLParser`
|
|
318
354
|
|
|
319
355
|
Defined in:
|
|
320
|
-
[epub/index.ts:
|
|
356
|
+
[epub/index.ts:268](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L268)
|
|
321
357
|
|
|
322
358
|
### Methods
|
|
323
359
|
|
|
@@ -326,7 +362,7 @@ Defined in:
|
|
|
326
362
|
> **\[dispose\]**(): `void`
|
|
327
363
|
|
|
328
364
|
Defined in:
|
|
329
|
-
[epub/index.ts:
|
|
365
|
+
[epub/index.ts:2995](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2995)
|
|
330
366
|
|
|
331
367
|
##### Returns
|
|
332
368
|
|
|
@@ -337,7 +373,7 @@ Defined in:
|
|
|
337
373
|
> **addCollection**(`collection`, `index?`): `Promise`\<`void`\>
|
|
338
374
|
|
|
339
375
|
Defined in:
|
|
340
|
-
[epub/index.ts:
|
|
376
|
+
[epub/index.ts:1696](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1696)
|
|
341
377
|
|
|
342
378
|
Add a collection to the EPUB metadata.
|
|
343
379
|
|
|
@@ -360,7 +396,7 @@ collections. Otherwise, it will be added to the end of the list.
|
|
|
360
396
|
> **addContributor**(`contributor`, `index?`): `Promise`\<`void`\>
|
|
361
397
|
|
|
362
398
|
Defined in:
|
|
363
|
-
[epub/index.ts:
|
|
399
|
+
[epub/index.ts:2038](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2038)
|
|
364
400
|
|
|
365
401
|
Add a contributor to the EPUB metadata.
|
|
366
402
|
|
|
@@ -390,7 +426,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
|
390
426
|
> **addCreator**(`creator`, `index?`, `type?`): `Promise`\<`void`\>
|
|
391
427
|
|
|
392
428
|
Defined in:
|
|
393
|
-
[epub/index.ts:
|
|
429
|
+
[epub/index.ts:1883](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1883)
|
|
394
430
|
|
|
395
431
|
Add a creator to the EPUB metadata.
|
|
396
432
|
|
|
@@ -420,7 +456,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
|
420
456
|
> **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
|
|
421
457
|
|
|
422
458
|
Defined in:
|
|
423
|
-
[epub/index.ts:
|
|
459
|
+
[epub/index.ts:2581](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2581)
|
|
424
460
|
|
|
425
461
|
Create a new manifest item and write its contents to a new entry.
|
|
426
462
|
|
|
@@ -449,7 +485,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
449
485
|
> **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
|
|
450
486
|
|
|
451
487
|
Defined in:
|
|
452
|
-
[epub/index.ts:
|
|
488
|
+
[epub/index.ts:2586](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2586)
|
|
453
489
|
|
|
454
490
|
Create a new manifest item and write its contents to a new entry.
|
|
455
491
|
|
|
@@ -478,7 +514,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
478
514
|
> **addManifestItem**(`item`, `contents`): `Promise`\<`void`\>
|
|
479
515
|
|
|
480
516
|
Defined in:
|
|
481
|
-
[epub/index.ts:
|
|
517
|
+
[epub/index.ts:2591](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2591)
|
|
482
518
|
|
|
483
519
|
Create a new manifest item and write its contents to a new entry.
|
|
484
520
|
|
|
@@ -506,7 +542,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
506
542
|
> **addMetadata**(`entry`): `Promise`\<`void`\>
|
|
507
543
|
|
|
508
544
|
Defined in:
|
|
509
|
-
[epub/index.ts:
|
|
545
|
+
[epub/index.ts:2702](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2702)
|
|
510
546
|
|
|
511
547
|
Add a new metadata entry to the Epub.
|
|
512
548
|
|
|
@@ -533,7 +569,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
|
533
569
|
> **addSpineItem**(`manifestId`, `index?`): `Promise`\<`void`\>
|
|
534
570
|
|
|
535
571
|
Defined in:
|
|
536
|
-
[epub/index.ts:
|
|
572
|
+
[epub/index.ts:2092](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2092)
|
|
537
573
|
|
|
538
574
|
Add an item to the spine of the EPUB.
|
|
539
575
|
|
|
@@ -563,7 +599,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
|
|
|
563
599
|
> **addSubject**(`subject`): `Promise`\<`void`\>
|
|
564
600
|
|
|
565
601
|
Defined in:
|
|
566
|
-
[epub/index.ts:
|
|
602
|
+
[epub/index.ts:1225](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1225)
|
|
567
603
|
|
|
568
604
|
Add a subject to the EPUB metadata.
|
|
569
605
|
|
|
@@ -586,7 +622,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
|
|
|
586
622
|
> **copy**(`path?`): `Promise`\<[`Epub`](#epub)\>
|
|
587
623
|
|
|
588
624
|
Defined in:
|
|
589
|
-
[epub/index.ts:
|
|
625
|
+
[epub/index.ts:630](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L630)
|
|
590
626
|
|
|
591
627
|
##### Parameters
|
|
592
628
|
|
|
@@ -605,7 +641,7 @@ Defined in:
|
|
|
605
641
|
> [`XmlElement`](#xmlelement)\<`"html"`\>)[]\>
|
|
606
642
|
|
|
607
643
|
Defined in:
|
|
608
|
-
[epub/index.ts:
|
|
644
|
+
[epub/index.ts:2398](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2398)
|
|
609
645
|
|
|
610
646
|
Create a new XHTML document with the given body and head.
|
|
611
647
|
|
|
@@ -627,7 +663,7 @@ Create a new XHTML document with the given body and head.
|
|
|
627
663
|
> **discardAndClose**(): `void`
|
|
628
664
|
|
|
629
665
|
Defined in:
|
|
630
|
-
[epub/index.ts:
|
|
666
|
+
[epub/index.ts:2945](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2945)
|
|
631
667
|
|
|
632
668
|
##### Returns
|
|
633
669
|
|
|
@@ -638,7 +674,7 @@ Defined in:
|
|
|
638
674
|
> **findAllMetadataItems**(`predicate`): `Promise`\<`object`[]\>
|
|
639
675
|
|
|
640
676
|
Defined in:
|
|
641
|
-
[epub/index.ts:
|
|
677
|
+
[epub/index.ts:895](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L895)
|
|
642
678
|
|
|
643
679
|
Returns the item in the metadata element's children array that matches the
|
|
644
680
|
provided predicate.
|
|
@@ -678,7 +714,7 @@ provided predicate.
|
|
|
678
714
|
> \}\>
|
|
679
715
|
|
|
680
716
|
Defined in:
|
|
681
|
-
[epub/index.ts:
|
|
717
|
+
[epub/index.ts:886](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L886)
|
|
682
718
|
|
|
683
719
|
Returns the item in the metadata element's children array that matches the
|
|
684
720
|
provided predicate.
|
|
@@ -717,7 +753,7 @@ provided predicate.
|
|
|
717
753
|
> **getBaseDirection**(): `Promise`\<`"auto"` \| `"rtl"` \| `"ltr"`\>
|
|
718
754
|
|
|
719
755
|
Defined in:
|
|
720
|
-
[epub/index.ts:
|
|
756
|
+
[epub/index.ts:1179](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1179)
|
|
721
757
|
|
|
722
758
|
Retrieve the base direction from the package element.
|
|
723
759
|
|
|
@@ -736,7 +772,7 @@ https://www.w3.org/TR/epub-33/#attrdef-dir
|
|
|
736
772
|
> **getCollections**(): `Promise`\<[`Collection`](#collection)[]\>
|
|
737
773
|
|
|
738
774
|
Defined in:
|
|
739
|
-
[epub/index.ts:
|
|
775
|
+
[epub/index.ts:1656](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1656)
|
|
740
776
|
|
|
741
777
|
Retrieve the list of collections.
|
|
742
778
|
|
|
@@ -749,7 +785,7 @@ Retrieve the list of collections.
|
|
|
749
785
|
> **getContributors**(): `Promise`\<[`DcCreator`](#dccreator)[]\>
|
|
750
786
|
|
|
751
787
|
Defined in:
|
|
752
|
-
[epub/index.ts:
|
|
788
|
+
[epub/index.ts:1870](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1870)
|
|
753
789
|
|
|
754
790
|
Retrieve the list of contributors.
|
|
755
791
|
|
|
@@ -768,7 +804,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccontributor
|
|
|
768
804
|
> **getCoverImage**(): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\>
|
|
769
805
|
|
|
770
806
|
Defined in:
|
|
771
|
-
[epub/index.ts:
|
|
807
|
+
[epub/index.ts:1075](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1075)
|
|
772
808
|
|
|
773
809
|
Retrieve the cover image data as a byte array.
|
|
774
810
|
|
|
@@ -789,7 +825,7 @@ https://www.w3.org/TR/epub-33/#sec-cover-image
|
|
|
789
825
|
> [`ManifestItem`](#manifestitem)\>
|
|
790
826
|
|
|
791
827
|
Defined in:
|
|
792
|
-
[epub/index.ts:
|
|
828
|
+
[epub/index.ts:1056](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1056)
|
|
793
829
|
|
|
794
830
|
Retrieve the cover image manifest item.
|
|
795
831
|
|
|
@@ -809,7 +845,7 @@ https://www.w3.org/TR/epub-33/#sec-cover-image
|
|
|
809
845
|
> **getCreators**(`type`): `Promise`\<[`DcCreator`](#dccreator)[]\>
|
|
810
846
|
|
|
811
847
|
Defined in:
|
|
812
|
-
[epub/index.ts:
|
|
848
|
+
[epub/index.ts:1809](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1809)
|
|
813
849
|
|
|
814
850
|
Retrieve the list of creators.
|
|
815
851
|
|
|
@@ -832,7 +868,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
|
832
868
|
> **getDescription**(): `Promise`\<`null` \| `string`\>
|
|
833
869
|
|
|
834
870
|
Defined in:
|
|
835
|
-
[epub/index.ts:
|
|
871
|
+
[epub/index.ts:1507](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1507)
|
|
836
872
|
|
|
837
873
|
Retrieve the Epub's description as specified in its package document metadata.
|
|
838
874
|
|
|
@@ -848,7 +884,7 @@ as a string. Descriptions may include HTML markup.
|
|
|
848
884
|
> **getGuideEntries**(): `Promise`\<`GuideItem`[]\>
|
|
849
885
|
|
|
850
886
|
Defined in:
|
|
851
|
-
[epub/index.ts:
|
|
887
|
+
[epub/index.ts:2922](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2922)
|
|
852
888
|
|
|
853
889
|
Retrieve the guide entries from the package document.
|
|
854
890
|
|
|
@@ -864,7 +900,7 @@ many publications still include it.
|
|
|
864
900
|
> **getIdentifier**(): `Promise`\<`null` \| `string`\>
|
|
865
901
|
|
|
866
902
|
Defined in:
|
|
867
|
-
[epub/index.ts:
|
|
903
|
+
[epub/index.ts:990](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L990)
|
|
868
904
|
|
|
869
905
|
Retrieve the identifier from the dc:identifier element in the EPUB metadata.
|
|
870
906
|
|
|
@@ -878,13 +914,37 @@ If there is no dc:identifier element, returns null.
|
|
|
878
914
|
|
|
879
915
|
https://www.w3.org/TR/epub-33/#sec-opf-dcidentifier
|
|
880
916
|
|
|
917
|
+
#### getItemArchiveLength()
|
|
918
|
+
|
|
919
|
+
> **getItemArchiveLength**(`id`): `Promise`\<`number`\>
|
|
920
|
+
|
|
921
|
+
Defined in:
|
|
922
|
+
[epub/index.ts:672](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L672)
|
|
923
|
+
|
|
924
|
+
Length of the underlying archive entry for a manifest item, in bytes Necessary
|
|
925
|
+
to compute the readium page count which is for COMPRESSED content
|
|
926
|
+
|
|
927
|
+
##### Parameters
|
|
928
|
+
|
|
929
|
+
| Parameter | Type |
|
|
930
|
+
| --------- | -------- |
|
|
931
|
+
| `id` | `string` |
|
|
932
|
+
|
|
933
|
+
##### Returns
|
|
934
|
+
|
|
935
|
+
`Promise`\<`number`\>
|
|
936
|
+
|
|
937
|
+
##### See
|
|
938
|
+
|
|
939
|
+
[https://github.com/readium/architecture/issues/123](https://github.com/readium/architecture/issues/123)
|
|
940
|
+
|
|
881
941
|
#### getLandmarks()
|
|
882
942
|
|
|
883
943
|
> **getLandmarks**(`__namedParameters`): `Promise`\<`null` \|
|
|
884
944
|
> [`Navigation`](#navigation)\>
|
|
885
945
|
|
|
886
946
|
Defined in:
|
|
887
|
-
[epub/index.ts:
|
|
947
|
+
[epub/index.ts:2271](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2271)
|
|
888
948
|
|
|
889
949
|
Returns the structured landmarks navigation document as a Navigation object
|
|
890
950
|
|
|
@@ -908,7 +968,7 @@ https://www.w3.org/TR/epub-33/#sec-nav-landmarks
|
|
|
908
968
|
> **getLanguage**(): `Promise`\<`null` \| `Locale`\>
|
|
909
969
|
|
|
910
970
|
Defined in:
|
|
911
|
-
[epub/index.ts:
|
|
971
|
+
[epub/index.ts:1344](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1344)
|
|
912
972
|
|
|
913
973
|
Retrieve the Epub's language as specified in its package document metadata.
|
|
914
974
|
|
|
@@ -928,7 +988,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
|
|
|
928
988
|
> **getLayout**(): `Promise`\<`"pre-paginated"` \| `"reflowable"`\>
|
|
929
989
|
|
|
930
990
|
Defined in:
|
|
931
|
-
[epub/index.ts:
|
|
991
|
+
[epub/index.ts:1160](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1160)
|
|
932
992
|
|
|
933
993
|
Retrieve the layout from the rendition:layout meta element in the EPUB metadata.
|
|
934
994
|
|
|
@@ -948,7 +1008,7 @@ https://www.w3.org/TR/epub-33/#layout
|
|
|
948
1008
|
> [`ManifestItem`](#manifestitem)\>\>
|
|
949
1009
|
|
|
950
1010
|
Defined in:
|
|
951
|
-
[epub/index.ts:
|
|
1011
|
+
[epub/index.ts:811](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L811)
|
|
952
1012
|
|
|
953
1013
|
Retrieve the manifest for the Epub.
|
|
954
1014
|
|
|
@@ -968,7 +1028,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
|
968
1028
|
> **getMetadata**(): `Promise`\<[`EpubMetadata`](#epubmetadata)\>
|
|
969
1029
|
|
|
970
1030
|
Defined in:
|
|
971
|
-
[epub/index.ts:
|
|
1031
|
+
[epub/index.ts:962](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L962)
|
|
972
1032
|
|
|
973
1033
|
Retrieve the metadata entries for the Epub.
|
|
974
1034
|
|
|
@@ -991,7 +1051,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
|
991
1051
|
> **getModifiedDate**(): `Promise`\<`null` \| `Date`\>
|
|
992
1052
|
|
|
993
1053
|
Defined in:
|
|
994
|
-
[epub/index.ts:
|
|
1054
|
+
[epub/index.ts:1143](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1143)
|
|
995
1055
|
|
|
996
1056
|
Retrieve the modified date from the dcterms:modified metadata in the EPUB
|
|
997
1057
|
metadata as a Date object.
|
|
@@ -1011,7 +1071,7 @@ https://www.w3.org/TR/epub-33/#sec-metadata-last-modified
|
|
|
1011
1071
|
> **getNcxTableOfContents**(): `Promise`\<[`NavigationList`](#navigationlist)\>
|
|
1012
1072
|
|
|
1013
1073
|
Defined in:
|
|
1014
|
-
[epub/index.ts:
|
|
1074
|
+
[epub/index.ts:2827](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2827)
|
|
1015
1075
|
|
|
1016
1076
|
Parse the NCX table of contents, if one exists, and return a tree of TocEntry
|
|
1017
1077
|
nodes.
|
|
@@ -1023,13 +1083,25 @@ and EPUB 3 publications that retain an NCX for backwards compatibility.
|
|
|
1023
1083
|
|
|
1024
1084
|
`Promise`\<[`NavigationList`](#navigationlist)\>
|
|
1025
1085
|
|
|
1086
|
+
#### getPackageElement()
|
|
1087
|
+
|
|
1088
|
+
> **getPackageElement**():
|
|
1089
|
+
> `Promise`\<[`XmlElement`](#xmlelement)\<`"package"`\>\>
|
|
1090
|
+
|
|
1091
|
+
Defined in:
|
|
1092
|
+
[epub/index.ts:746](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L746)
|
|
1093
|
+
|
|
1094
|
+
##### Returns
|
|
1095
|
+
|
|
1096
|
+
`Promise`\<[`XmlElement`](#xmlelement)\<`"package"`\>\>
|
|
1097
|
+
|
|
1026
1098
|
#### getPackageVocabularyPrefixes()
|
|
1027
1099
|
|
|
1028
1100
|
> **getPackageVocabularyPrefixes**(): `Promise`\<`Record`\<`string`,
|
|
1029
1101
|
> `string`\>\>
|
|
1030
1102
|
|
|
1031
1103
|
Defined in:
|
|
1032
|
-
[epub/index.ts:
|
|
1104
|
+
[epub/index.ts:1524](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1524)
|
|
1033
1105
|
|
|
1034
1106
|
Return the set of custom vocabulary prefixes set on this publication's root
|
|
1035
1107
|
package element.
|
|
@@ -1050,7 +1122,7 @@ https://www.w3.org/TR/epub-33/#sec-prefix-attr
|
|
|
1050
1122
|
> [`Navigation`](#navigation)\>
|
|
1051
1123
|
|
|
1052
1124
|
Defined in:
|
|
1053
|
-
[epub/index.ts:
|
|
1125
|
+
[epub/index.ts:2283](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2283)
|
|
1054
1126
|
|
|
1055
1127
|
Returns the structured page list navigation document as a Navigation object
|
|
1056
1128
|
|
|
@@ -1074,7 +1146,7 @@ https://www.w3.org/TR/epub-33/#sec-nav-landmarks
|
|
|
1074
1146
|
> **getPublicationDate**(): `Promise`\<`null` \| `Date`\>
|
|
1075
1147
|
|
|
1076
1148
|
Defined in:
|
|
1077
|
-
[epub/index.ts:
|
|
1149
|
+
[epub/index.ts:1112](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1112)
|
|
1078
1150
|
|
|
1079
1151
|
Retrieve the publication date from the dc:date element in the EPUB metadata as a
|
|
1080
1152
|
Date object.
|
|
@@ -1094,7 +1166,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcdate
|
|
|
1094
1166
|
> **getRootfile**(): `Promise`\<`string`\>
|
|
1095
1167
|
|
|
1096
1168
|
Defined in:
|
|
1097
|
-
[epub/index.ts:
|
|
1169
|
+
[epub/index.ts:682](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L682)
|
|
1098
1170
|
|
|
1099
1171
|
##### Returns
|
|
1100
1172
|
|
|
@@ -1105,7 +1177,7 @@ Defined in:
|
|
|
1105
1177
|
> **getSpineItems**(): `Promise`\<[`ManifestItem`](#manifestitem)[]\>
|
|
1106
1178
|
|
|
1107
1179
|
Defined in:
|
|
1108
|
-
[epub/index.ts:
|
|
1180
|
+
[epub/index.ts:2073](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2073)
|
|
1109
1181
|
|
|
1110
1182
|
Retrieve the manifest items that make up the Epub's spine.
|
|
1111
1183
|
|
|
@@ -1125,7 +1197,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
|
|
|
1125
1197
|
> **getSubjects**(): `Promise`\<(`string` \| [`DcSubject`](#dcsubject))[]\>
|
|
1126
1198
|
|
|
1127
1199
|
Defined in:
|
|
1128
|
-
[epub/index.ts:
|
|
1200
|
+
[epub/index.ts:1299](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1299)
|
|
1129
1201
|
|
|
1130
1202
|
Retrieve the list of subjects for this EPUB.
|
|
1131
1203
|
|
|
@@ -1146,7 +1218,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
|
|
|
1146
1218
|
> **getSubtitle**(): `Promise`\<`null` \| `string`\>
|
|
1147
1219
|
|
|
1148
1220
|
Defined in:
|
|
1149
|
-
[epub/index.ts:
|
|
1221
|
+
[epub/index.ts:1414](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1414)
|
|
1150
1222
|
|
|
1151
1223
|
Retrieve the subtitle of the Epub, if it exists.
|
|
1152
1224
|
|
|
@@ -1164,7 +1236,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
|
1164
1236
|
> [`Navigation`](#navigation)\>
|
|
1165
1237
|
|
|
1166
1238
|
Defined in:
|
|
1167
|
-
[epub/index.ts:
|
|
1239
|
+
[epub/index.ts:2254](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2254)
|
|
1168
1240
|
|
|
1169
1241
|
Returns the structured table of contents navigation document as a Navigation
|
|
1170
1242
|
object.
|
|
@@ -1189,7 +1261,7 @@ https://www.w3.org/TR/epub-33/#sec-nav-toc
|
|
|
1189
1261
|
> **getTitle**(`expanded`): `Promise`\<`null` \| `string`\>
|
|
1190
1262
|
|
|
1191
1263
|
Defined in:
|
|
1192
|
-
[epub/index.ts:
|
|
1264
|
+
[epub/index.ts:1390](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1390)
|
|
1193
1265
|
|
|
1194
1266
|
Retrieve the title of the Epub.
|
|
1195
1267
|
|
|
@@ -1212,7 +1284,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
|
1212
1284
|
> **getTitles**(): `Promise`\<`object`[]\>
|
|
1213
1285
|
|
|
1214
1286
|
Defined in:
|
|
1215
|
-
[epub/index.ts:
|
|
1287
|
+
[epub/index.ts:1426](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1426)
|
|
1216
1288
|
|
|
1217
1289
|
Retrieve all title entries of the Epub.
|
|
1218
1290
|
|
|
@@ -1229,7 +1301,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
|
1229
1301
|
> **getType**(): `Promise`\<`null` \| [`MetadataEntry`](#metadataentry)\>
|
|
1230
1302
|
|
|
1231
1303
|
Defined in:
|
|
1232
|
-
[epub/index.ts:
|
|
1304
|
+
[epub/index.ts:1212](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1212)
|
|
1233
1305
|
|
|
1234
1306
|
Retrieve the publication type from the dc:type element in the EPUB metadata.
|
|
1235
1307
|
|
|
@@ -1248,7 +1320,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctype
|
|
|
1248
1320
|
> **getVersion**(): `Promise`\<`string`\>
|
|
1249
1321
|
|
|
1250
1322
|
Defined in:
|
|
1251
|
-
[epub/index.ts:
|
|
1323
|
+
[epub/index.ts:2814](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2814)
|
|
1252
1324
|
|
|
1253
1325
|
Returns the EPUB version declared on the package element.
|
|
1254
1326
|
|
|
@@ -1264,7 +1336,7 @@ Returns the EPUB version declared on the package element.
|
|
|
1264
1336
|
> `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
1265
1337
|
|
|
1266
1338
|
Defined in:
|
|
1267
|
-
[epub/index.ts:
|
|
1339
|
+
[epub/index.ts:2337](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2337)
|
|
1268
1340
|
|
|
1269
1341
|
Retrieve the contents of a file, given its href.
|
|
1270
1342
|
|
|
@@ -1287,7 +1359,7 @@ encoding parameter.
|
|
|
1287
1359
|
> **readFileContents**(`href`, `relativeTo`, `encoding`): `Promise`\<`string`\>
|
|
1288
1360
|
|
|
1289
1361
|
Defined in:
|
|
1290
|
-
[epub/index.ts:
|
|
1362
|
+
[epub/index.ts:2338](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2338)
|
|
1291
1363
|
|
|
1292
1364
|
Retrieve the contents of a file, given its href.
|
|
1293
1365
|
|
|
@@ -1313,7 +1385,7 @@ encoding parameter.
|
|
|
1313
1385
|
> **readItemContents**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
1314
1386
|
|
|
1315
1387
|
Defined in:
|
|
1316
|
-
[epub/index.ts:
|
|
1388
|
+
[epub/index.ts:2370](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2370)
|
|
1317
1389
|
|
|
1318
1390
|
Retrieve the contents of a manifest item, given its id.
|
|
1319
1391
|
|
|
@@ -1336,7 +1408,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
1336
1408
|
> **readItemContents**(`id`, `encoding`): `Promise`\<`string`\>
|
|
1337
1409
|
|
|
1338
1410
|
Defined in:
|
|
1339
|
-
[epub/index.ts:
|
|
1411
|
+
[epub/index.ts:2371](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2371)
|
|
1340
1412
|
|
|
1341
1413
|
Retrieve the contents of a manifest item, given its id.
|
|
1342
1414
|
|
|
@@ -1362,7 +1434,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
1362
1434
|
> **readXhtmlItemContents**(`id`, `as?`): `Promise`\<[`ParsedXml`](#parsedxml)\>
|
|
1363
1435
|
|
|
1364
1436
|
Defined in:
|
|
1365
|
-
[epub/index.ts:
|
|
1437
|
+
[epub/index.ts:2433](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2433)
|
|
1366
1438
|
|
|
1367
1439
|
Retrieves the contents of an XHTML item, given its manifest id.
|
|
1368
1440
|
|
|
@@ -1386,7 +1458,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
|
|
|
1386
1458
|
> **readXhtmlItemContents**(`id`, `as`): `Promise`\<`string`\>
|
|
1387
1459
|
|
|
1388
1460
|
Defined in:
|
|
1389
|
-
[epub/index.ts:
|
|
1461
|
+
[epub/index.ts:2434](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2434)
|
|
1390
1462
|
|
|
1391
1463
|
Retrieves the contents of an XHTML item, given its manifest id.
|
|
1392
1464
|
|
|
@@ -1410,7 +1482,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
|
|
|
1410
1482
|
> **removeCollection**(`index`): `Promise`\<`void`\>
|
|
1411
1483
|
|
|
1412
1484
|
Defined in:
|
|
1413
|
-
[epub/index.ts:
|
|
1485
|
+
[epub/index.ts:1765](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1765)
|
|
1414
1486
|
|
|
1415
1487
|
Remove a collection from the EPUB metadata.
|
|
1416
1488
|
|
|
@@ -1432,7 +1504,7 @@ returned by `epub.getCollections()`.
|
|
|
1432
1504
|
> **removeContributor**(`index`): `Promise`\<`void`\>
|
|
1433
1505
|
|
|
1434
1506
|
Defined in:
|
|
1435
|
-
[epub/index.ts:
|
|
1507
|
+
[epub/index.ts:2022](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2022)
|
|
1436
1508
|
|
|
1437
1509
|
Remove a contributor from the EPUB metadata.
|
|
1438
1510
|
|
|
@@ -1460,7 +1532,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
|
1460
1532
|
> **removeCreator**(`index`, `type`): `Promise`\<`void`\>
|
|
1461
1533
|
|
|
1462
1534
|
Defined in:
|
|
1463
|
-
[epub/index.ts:
|
|
1535
|
+
[epub/index.ts:1970](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1970)
|
|
1464
1536
|
|
|
1465
1537
|
Remove a creator from the EPUB metadata.
|
|
1466
1538
|
|
|
@@ -1487,7 +1559,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
|
1487
1559
|
> **removeManifestItem**(`id`): `Promise`\<`void`\>
|
|
1488
1560
|
|
|
1489
1561
|
Defined in:
|
|
1490
|
-
[epub/index.ts:
|
|
1562
|
+
[epub/index.ts:2538](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2538)
|
|
1491
1563
|
|
|
1492
1564
|
##### Parameters
|
|
1493
1565
|
|
|
@@ -1504,7 +1576,7 @@ Defined in:
|
|
|
1504
1576
|
> **removeMetadata**(`predicate`): `Promise`\<`void`\>
|
|
1505
1577
|
|
|
1506
1578
|
Defined in:
|
|
1507
|
-
[epub/index.ts:
|
|
1579
|
+
[epub/index.ts:2786](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2786)
|
|
1508
1580
|
|
|
1509
1581
|
Remove one or more metadata entries.
|
|
1510
1582
|
|
|
@@ -1530,7 +1602,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
|
1530
1602
|
> **removeSpineItem**(`index`): `Promise`\<`void`\>
|
|
1531
1603
|
|
|
1532
1604
|
Defined in:
|
|
1533
|
-
[epub/index.ts:
|
|
1605
|
+
[epub/index.ts:2128](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2128)
|
|
1534
1606
|
|
|
1535
1607
|
Remove the spine item at the specified index.
|
|
1536
1608
|
|
|
@@ -1553,7 +1625,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
|
|
|
1553
1625
|
> **removeSubject**(`index`): `Promise`\<`void`\>
|
|
1554
1626
|
|
|
1555
1627
|
Defined in:
|
|
1556
|
-
[epub/index.ts:
|
|
1628
|
+
[epub/index.ts:1262](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1262)
|
|
1557
1629
|
|
|
1558
1630
|
Remove a subject from the EPUB metadata.
|
|
1559
1631
|
|
|
@@ -1579,7 +1651,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
|
|
|
1579
1651
|
> **replaceMetadata**(`predicate`, `entry`): `Promise`\<`void`\>
|
|
1580
1652
|
|
|
1581
1653
|
Defined in:
|
|
1582
|
-
[epub/index.ts:
|
|
1654
|
+
[epub/index.ts:2741](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2741)
|
|
1583
1655
|
|
|
1584
1656
|
Replace a metadata entry with a new one.
|
|
1585
1657
|
|
|
@@ -1607,7 +1679,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
|
|
|
1607
1679
|
> `Promise`\<`string`\>
|
|
1608
1680
|
|
|
1609
1681
|
Defined in:
|
|
1610
|
-
[epub/index.ts:
|
|
1682
|
+
[epub/index.ts:2309](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2309)
|
|
1611
1683
|
|
|
1612
1684
|
Returns a path-relative-scheme-less URL, relative to the container root.
|
|
1613
1685
|
|
|
@@ -1629,7 +1701,7 @@ Returns a path-relative-scheme-less URL, relative to the container root.
|
|
|
1629
1701
|
> **saveAndClose**(): `Promise`\<`void`\>
|
|
1630
1702
|
|
|
1631
1703
|
Defined in:
|
|
1632
|
-
[epub/index.ts:
|
|
1704
|
+
[epub/index.ts:2960](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2960)
|
|
1633
1705
|
|
|
1634
1706
|
Write the current contents of the Epub to a new EPUB archive on disk.
|
|
1635
1707
|
|
|
@@ -1645,7 +1717,7 @@ updated to the current UTC timestamp.
|
|
|
1645
1717
|
> **setCoverImage**(`href`, `data`): `Promise`\<`void`\>
|
|
1646
1718
|
|
|
1647
1719
|
Defined in:
|
|
1648
|
-
[epub/index.ts:
|
|
1720
|
+
[epub/index.ts:1089](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1089)
|
|
1649
1721
|
|
|
1650
1722
|
Set the cover image for the EPUB.
|
|
1651
1723
|
|
|
@@ -1668,7 +1740,7 @@ then writes the provided image data to the provided href within the publication.
|
|
|
1668
1740
|
> **setDescription**(`description`): `Promise`\<`void`\>
|
|
1669
1741
|
|
|
1670
1742
|
Defined in:
|
|
1671
|
-
[epub/index.ts:
|
|
1743
|
+
[epub/index.ts:1491](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1491)
|
|
1672
1744
|
|
|
1673
1745
|
Update the Epub's description metadata entry.
|
|
1674
1746
|
|
|
@@ -1691,7 +1763,7 @@ encoded as HTML entities.
|
|
|
1691
1763
|
> **setIdentifier**(`identifier`): `Promise`\<`void`\>
|
|
1692
1764
|
|
|
1693
1765
|
Defined in:
|
|
1694
|
-
[epub/index.ts:
|
|
1766
|
+
[epub/index.ts:1004](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1004)
|
|
1695
1767
|
|
|
1696
1768
|
Set the dc:identifier metadata element with the provided string.
|
|
1697
1769
|
|
|
@@ -1717,7 +1789,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcidentifier
|
|
|
1717
1789
|
> **setLanguage**(`locale`): `Promise`\<`void`\>
|
|
1718
1790
|
|
|
1719
1791
|
Defined in:
|
|
1720
|
-
[epub/index.ts:
|
|
1792
|
+
[epub/index.ts:1373](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1373)
|
|
1721
1793
|
|
|
1722
1794
|
Update the Epub's language metadata entry.
|
|
1723
1795
|
|
|
@@ -1743,7 +1815,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
|
|
|
1743
1815
|
> **setPackageVocabularyPrefix**(`prefix`, `uri`): `Promise`\<`void`\>
|
|
1744
1816
|
|
|
1745
1817
|
Defined in:
|
|
1746
|
-
[epub/index.ts:
|
|
1818
|
+
[epub/index.ts:1542](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1542)
|
|
1747
1819
|
|
|
1748
1820
|
Set a custom vocabulary prefix on the root package element.
|
|
1749
1821
|
|
|
@@ -1767,7 +1839,7 @@ https://www.w3.org/TR/epub-33/#sec-prefix-attr
|
|
|
1767
1839
|
> **setPublicationDate**(`date`): `Promise`\<`void`\>
|
|
1768
1840
|
|
|
1769
1841
|
Defined in:
|
|
1770
|
-
[epub/index.ts:
|
|
1842
|
+
[epub/index.ts:1127](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1127)
|
|
1771
1843
|
|
|
1772
1844
|
Set the dc:date metadata element with the provided date.
|
|
1773
1845
|
|
|
@@ -1793,7 +1865,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcdate
|
|
|
1793
1865
|
> **setTitle**(`title`): `Promise`\<`void`\>
|
|
1794
1866
|
|
|
1795
1867
|
Defined in:
|
|
1796
|
-
[epub/index.ts:
|
|
1868
|
+
[epub/index.ts:1566](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1566)
|
|
1797
1869
|
|
|
1798
1870
|
Set the title of the Epub.
|
|
1799
1871
|
|
|
@@ -1821,7 +1893,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
|
|
|
1821
1893
|
> **setTitles**(`entries`): `Promise`\<`void`\>
|
|
1822
1894
|
|
|
1823
1895
|
Defined in:
|
|
1824
|
-
[epub/index.ts:
|
|
1896
|
+
[epub/index.ts:1594](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1594)
|
|
1825
1897
|
|
|
1826
1898
|
##### Parameters
|
|
1827
1899
|
|
|
@@ -1838,7 +1910,7 @@ Defined in:
|
|
|
1838
1910
|
> **setType**(`type`): `Promise`\<`void`\>
|
|
1839
1911
|
|
|
1840
1912
|
Defined in:
|
|
1841
|
-
[epub/index.ts:
|
|
1913
|
+
[epub/index.ts:1196](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1196)
|
|
1842
1914
|
|
|
1843
1915
|
Set the dc:type metadata element.
|
|
1844
1916
|
|
|
@@ -1864,7 +1936,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctype
|
|
|
1864
1936
|
> **updateManifestItem**(`id`, `newItem`): `Promise`\<`void`\>
|
|
1865
1937
|
|
|
1866
1938
|
Defined in:
|
|
1867
|
-
[epub/index.ts:
|
|
1939
|
+
[epub/index.ts:2653](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2653)
|
|
1868
1940
|
|
|
1869
1941
|
Update the manifest entry for an existing item.
|
|
1870
1942
|
|
|
@@ -1886,6 +1958,30 @@ To update the contents of an entry, use `epub.writeItemContents()` or
|
|
|
1886
1958
|
|
|
1887
1959
|
https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
1888
1960
|
|
|
1961
|
+
#### withPackage()
|
|
1962
|
+
|
|
1963
|
+
> **withPackage**(`producer`): `Promise`\<`void`\>
|
|
1964
|
+
|
|
1965
|
+
Defined in:
|
|
1966
|
+
[epub/index.ts:772](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L772)
|
|
1967
|
+
|
|
1968
|
+
Safely modify the package document, without race conditions.
|
|
1969
|
+
|
|
1970
|
+
Since the reading the package document is an async process, multiple
|
|
1971
|
+
simultaneously dispatched function calls that all attempt to modify it can
|
|
1972
|
+
clobber each other's changes. This method uses a mutex to ensure that each
|
|
1973
|
+
update runs exclusively.
|
|
1974
|
+
|
|
1975
|
+
##### Parameters
|
|
1976
|
+
|
|
1977
|
+
| Parameter | Type | Description |
|
|
1978
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1979
|
+
| `producer` | (`packageElement`) => `void` \| (`packageElement`) => [`PackageElement`](#packageelement) \| (`packageElement`) => `Promise`\<[`PackageElement`](#packageelement)\> \| (`packageElement`) => `Promise`\<`void`\> | The function to update the package document. If it returns a new package document, that will be persisted, otherwise it will be assumed that the package document was modified in place. |
|
|
1980
|
+
|
|
1981
|
+
##### Returns
|
|
1982
|
+
|
|
1983
|
+
`Promise`\<`void`\>
|
|
1984
|
+
|
|
1889
1985
|
#### writeItemContents()
|
|
1890
1986
|
|
|
1891
1987
|
##### Call Signature
|
|
@@ -1893,7 +1989,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-manifest
|
|
|
1893
1989
|
> **writeItemContents**(`id`, `contents`): `Promise`\<`void`\>
|
|
1894
1990
|
|
|
1895
1991
|
Defined in:
|
|
1896
|
-
[epub/index.ts:
|
|
1992
|
+
[epub/index.ts:2490](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2490)
|
|
1897
1993
|
|
|
1898
1994
|
Write new contents for an existing manifest item, specified by its id.
|
|
1899
1995
|
|
|
@@ -1920,7 +2016,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
1920
2016
|
> **writeItemContents**(`id`, `contents`, `encoding`): `Promise`\<`void`\>
|
|
1921
2017
|
|
|
1922
2018
|
Defined in:
|
|
1923
|
-
[epub/index.ts:
|
|
2019
|
+
[epub/index.ts:2491](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2491)
|
|
1924
2020
|
|
|
1925
2021
|
Write new contents for an existing manifest item, specified by its id.
|
|
1926
2022
|
|
|
@@ -1948,7 +2044,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
|
|
|
1948
2044
|
> **writeXhtmlItemContents**(`id`, `contents`): `Promise`\<`void`\>
|
|
1949
2045
|
|
|
1950
2046
|
Defined in:
|
|
1951
|
-
[epub/index.ts:
|
|
2047
|
+
[epub/index.ts:2530](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2530)
|
|
1952
2048
|
|
|
1953
2049
|
Write new contents for an existing XHTML item, specified by its id.
|
|
1954
2050
|
|
|
@@ -1975,7 +2071,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
|
|
|
1975
2071
|
> `static` **addLinkToXhtmlHead**(`xml`, `link`): `void`
|
|
1976
2072
|
|
|
1977
2073
|
Defined in:
|
|
1978
|
-
[epub/index.ts:
|
|
2074
|
+
[epub/index.ts:345](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L345)
|
|
1979
2075
|
|
|
1980
2076
|
Given an XML structure representing a complete XHTML document, add a `link`
|
|
1981
2077
|
element to the `head` of the document.
|
|
@@ -1996,22 +2092,40 @@ This method modifies the provided XML structure.
|
|
|
1996
2092
|
|
|
1997
2093
|
`void`
|
|
1998
2094
|
|
|
2095
|
+
#### assertEpub3()
|
|
2096
|
+
|
|
2097
|
+
> `static` **assertEpub3**(`epub`): `Promise`\<`void`\>
|
|
2098
|
+
|
|
2099
|
+
Defined in:
|
|
2100
|
+
[epub/index.ts:620](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L620)
|
|
2101
|
+
|
|
2102
|
+
##### Parameters
|
|
2103
|
+
|
|
2104
|
+
| Parameter | Type |
|
|
2105
|
+
| --------- | --------------- |
|
|
2106
|
+
| `epub` | [`Epub`](#epub) |
|
|
2107
|
+
|
|
2108
|
+
##### Returns
|
|
2109
|
+
|
|
2110
|
+
`Promise`\<`void`\>
|
|
2111
|
+
|
|
1999
2112
|
#### create()
|
|
2000
2113
|
|
|
2001
|
-
> `static` **create**(`path`, `
|
|
2114
|
+
> `static` **create**(`path`, `dublinCore`, `additionalMetadata`):
|
|
2002
2115
|
> `Promise`\<[`Epub`](#epub)\>
|
|
2003
2116
|
|
|
2004
2117
|
Defined in:
|
|
2005
|
-
[epub/index.ts:
|
|
2118
|
+
[epub/index.ts:568](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L568)
|
|
2006
2119
|
|
|
2007
|
-
Construct
|
|
2120
|
+
Construct a new EPUB on a writable backend, optionally seeded with the provided
|
|
2121
|
+
metadata. Equivalent to `Epub.using(TmpFsAdapter).create(...)`.
|
|
2008
2122
|
|
|
2009
2123
|
##### Parameters
|
|
2010
2124
|
|
|
2011
2125
|
| Parameter | Type | Default value | Description |
|
|
2012
2126
|
| -------------------- | ------------------------------- | ------------- | --------------------------------------- |
|
|
2013
2127
|
| `path` | `string` | `undefined` | - |
|
|
2014
|
-
| `
|
|
2128
|
+
| `dublinCore` | [`DublinCore`](#dublincore) | `undefined` | Core metadata terms |
|
|
2015
2129
|
| `additionalMetadata` | [`EpubMetadata`](#epubmetadata) | `[]` | An array of additional metadata entries |
|
|
2016
2130
|
|
|
2017
2131
|
##### Returns
|
|
@@ -2024,7 +2138,7 @@ Construct an Epub instance, optionally beginning with the provided metadata.
|
|
|
2024
2138
|
> [`XmlElement`](#xmlelement)\<`Name`\>
|
|
2025
2139
|
|
|
2026
2140
|
Defined in:
|
|
2027
|
-
[epub/index.ts:
|
|
2141
|
+
[epub/index.ts:380](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L380)
|
|
2028
2142
|
|
|
2029
2143
|
##### Type Parameters
|
|
2030
2144
|
|
|
@@ -2049,7 +2163,7 @@ Defined in:
|
|
|
2049
2163
|
> `static` **createXmlTextNode**(`text`): [`XmlTextNode`](#xmltextnode)
|
|
2050
2164
|
|
|
2051
2165
|
Defined in:
|
|
2052
|
-
[epub/index.ts:
|
|
2166
|
+
[epub/index.ts:393](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L393)
|
|
2053
2167
|
|
|
2054
2168
|
##### Parameters
|
|
2055
2169
|
|
|
@@ -2067,7 +2181,7 @@ Defined in:
|
|
|
2067
2181
|
> `undefined` \| [`XmlElement`](#xmlelement)\<`Name`\>
|
|
2068
2182
|
|
|
2069
2183
|
Defined in:
|
|
2070
|
-
[epub/index.ts:
|
|
2184
|
+
[epub/index.ts:466](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L466)
|
|
2071
2185
|
|
|
2072
2186
|
Given an XML structure, find the first child matching the provided name and
|
|
2073
2187
|
optional filter.
|
|
@@ -2096,7 +2210,7 @@ optional filter.
|
|
|
2096
2210
|
> `undefined` \| [`XmlElement`](#xmlelement)\<`Name`\>
|
|
2097
2211
|
|
|
2098
2212
|
Defined in:
|
|
2099
|
-
[epub/index.ts:
|
|
2213
|
+
[epub/index.ts:484](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L484)
|
|
2100
2214
|
|
|
2101
2215
|
Given an XML structure, find the first descendant matching the provided name and
|
|
2102
2216
|
optional filter.
|
|
@@ -2127,7 +2241,7 @@ element in the tree matching the name and filter.
|
|
|
2127
2241
|
> `static` **formatSmilDuration**(`duration`): `string`
|
|
2128
2242
|
|
|
2129
2243
|
Defined in:
|
|
2130
|
-
[epub/index.ts:
|
|
2244
|
+
[epub/index.ts:328](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L328)
|
|
2131
2245
|
|
|
2132
2246
|
Format a duration, provided as a number of seconds, as a SMIL clock value, to be
|
|
2133
2247
|
used for Media Overlays.
|
|
@@ -2148,29 +2262,103 @@ https://www.w3.org/TR/epub-33/#sec-duration
|
|
|
2148
2262
|
|
|
2149
2263
|
#### from()
|
|
2150
2264
|
|
|
2265
|
+
##### Call Signature
|
|
2266
|
+
|
|
2151
2267
|
> `static` **from**(`pathOrData`): `Promise`\<[`Epub`](#epub)\>
|
|
2152
2268
|
|
|
2153
2269
|
Defined in:
|
|
2154
|
-
[epub/index.ts:
|
|
2270
|
+
[epub/index.ts:604](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L604)
|
|
2155
2271
|
|
|
2156
|
-
|
|
2272
|
+
Open an existing EPUB publication, extracting it to a temp directory so writes
|
|
2273
|
+
can mutate the unpacked tree and rezip with `saveAndClose`.
|
|
2157
2274
|
|
|
2158
|
-
|
|
2275
|
+
Pass `{ readonly: true }` to gate mutations at runtime.
|
|
2159
2276
|
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
| `pathOrData` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> | Must be either a string representing the path to an EPUB file on disk, or a Uint8Array representing the data of the EPUB publication. |
|
|
2277
|
+
prefer `Epub.using(TmpFsAdapter).from(path)` (or
|
|
2278
|
+
`Epub.using(MemoryAdapter).from(path)` for read-only, in-memory access)
|
|
2163
2279
|
|
|
2164
|
-
|
|
2280
|
+
###### Parameters
|
|
2281
|
+
|
|
2282
|
+
| Parameter | Type |
|
|
2283
|
+
| ------------ | --------------------------------------------- |
|
|
2284
|
+
| `pathOrData` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
2285
|
+
|
|
2286
|
+
###### Returns
|
|
2165
2287
|
|
|
2166
2288
|
`Promise`\<[`Epub`](#epub)\>
|
|
2167
2289
|
|
|
2290
|
+
###### Throws
|
|
2291
|
+
|
|
2292
|
+
when the archive is not a valid EPUB 3
|
|
2293
|
+
|
|
2294
|
+
##### Call Signature
|
|
2295
|
+
|
|
2296
|
+
> `static` **from**(`pathOrData`, `options`):
|
|
2297
|
+
> `Promise`\<[`EpubReader`](#epubreader)\>
|
|
2298
|
+
|
|
2299
|
+
Defined in:
|
|
2300
|
+
[epub/index.ts:605](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L605)
|
|
2301
|
+
|
|
2302
|
+
Open an existing EPUB publication, extracting it to a temp directory so writes
|
|
2303
|
+
can mutate the unpacked tree and rezip with `saveAndClose`.
|
|
2304
|
+
|
|
2305
|
+
Pass `{ readonly: true }` to gate mutations at runtime.
|
|
2306
|
+
|
|
2307
|
+
prefer `Epub.using(TmpFsAdapter).from(path)` (or
|
|
2308
|
+
`Epub.using(MemoryAdapter).from(path)` for read-only, in-memory access)
|
|
2309
|
+
|
|
2310
|
+
###### Parameters
|
|
2311
|
+
|
|
2312
|
+
| Parameter | Type |
|
|
2313
|
+
| ------------ | --------------------------------------------- |
|
|
2314
|
+
| `pathOrData` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
2315
|
+
| `options` | [`FromOptions`](#fromoptions) & `object` |
|
|
2316
|
+
|
|
2317
|
+
###### Returns
|
|
2318
|
+
|
|
2319
|
+
`Promise`\<[`EpubReader`](#epubreader)\>
|
|
2320
|
+
|
|
2321
|
+
###### Throws
|
|
2322
|
+
|
|
2323
|
+
when the archive is not a valid EPUB 3
|
|
2324
|
+
|
|
2325
|
+
##### Call Signature
|
|
2326
|
+
|
|
2327
|
+
> `static` **from**(`pathOrData`, `options?`): `Promise`\<[`Epub`](#epub) \|
|
|
2328
|
+
> [`EpubReader`](#epubreader)\>
|
|
2329
|
+
|
|
2330
|
+
Defined in:
|
|
2331
|
+
[epub/index.ts:609](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L609)
|
|
2332
|
+
|
|
2333
|
+
Open an existing EPUB publication, extracting it to a temp directory so writes
|
|
2334
|
+
can mutate the unpacked tree and rezip with `saveAndClose`.
|
|
2335
|
+
|
|
2336
|
+
Pass `{ readonly: true }` to gate mutations at runtime.
|
|
2337
|
+
|
|
2338
|
+
prefer `Epub.using(TmpFsAdapter).from(path)` (or
|
|
2339
|
+
`Epub.using(MemoryAdapter).from(path)` for read-only, in-memory access)
|
|
2340
|
+
|
|
2341
|
+
###### Parameters
|
|
2342
|
+
|
|
2343
|
+
| Parameter | Type |
|
|
2344
|
+
| ------------ | --------------------------------------------- |
|
|
2345
|
+
| `pathOrData` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
2346
|
+
| `options?` | [`FromOptions`](#fromoptions) |
|
|
2347
|
+
|
|
2348
|
+
###### Returns
|
|
2349
|
+
|
|
2350
|
+
`Promise`\<[`Epub`](#epub) \| [`EpubReader`](#epubreader)\>
|
|
2351
|
+
|
|
2352
|
+
###### Throws
|
|
2353
|
+
|
|
2354
|
+
when the archive is not a valid EPUB 3
|
|
2355
|
+
|
|
2168
2356
|
#### getXhtmlBody()
|
|
2169
2357
|
|
|
2170
2358
|
> `static` **getXhtmlBody**(`xml`): [`ParsedXml`](#parsedxml)
|
|
2171
2359
|
|
|
2172
2360
|
Defined in:
|
|
2173
|
-
[epub/index.ts:
|
|
2361
|
+
[epub/index.ts:370](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L370)
|
|
2174
2362
|
|
|
2175
2363
|
Given an XML structure representing a complete XHTML document, return the
|
|
2176
2364
|
sub-structure representing the children of the document's body element.
|
|
@@ -2190,7 +2378,7 @@ sub-structure representing the children of the document's body element.
|
|
|
2190
2378
|
> `static` **getXhtmlTextContent**(`xml`): `string`
|
|
2191
2379
|
|
|
2192
2380
|
Defined in:
|
|
2193
|
-
[epub/index.ts:
|
|
2381
|
+
[epub/index.ts:402](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L402)
|
|
2194
2382
|
|
|
2195
2383
|
Given an XML structure representing a complete XHTML document, return a string
|
|
2196
2384
|
representing the concatenation of all text nodes in the document.
|
|
@@ -2210,7 +2398,7 @@ representing the concatenation of all text nodes in the document.
|
|
|
2210
2398
|
> `static` **getXmlAttributes**(`element`): `Record`\<`string`, `string`\>
|
|
2211
2399
|
|
|
2212
2400
|
Defined in:
|
|
2213
|
-
[epub/index.ts:
|
|
2401
|
+
[epub/index.ts:419](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L419)
|
|
2214
2402
|
|
|
2215
2403
|
Given an XMLElement, return its attributes.
|
|
2216
2404
|
|
|
@@ -2229,7 +2417,7 @@ Given an XMLElement, return its attributes.
|
|
|
2229
2417
|
> `static` **getXmlChildren**\<`Name`\>(`element`): [`ParsedXml`](#parsedxml)
|
|
2230
2418
|
|
|
2231
2419
|
Defined in:
|
|
2232
|
-
[epub/index.ts:
|
|
2420
|
+
[epub/index.ts:446](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L446)
|
|
2233
2421
|
|
|
2234
2422
|
Given an XMLElement, return a list of its children
|
|
2235
2423
|
|
|
@@ -2254,7 +2442,7 @@ Given an XMLElement, return a list of its children
|
|
|
2254
2442
|
> `static` **getXmlElementName**\<`Name`\>(`element`): `Name`
|
|
2255
2443
|
|
|
2256
2444
|
Defined in:
|
|
2257
|
-
[epub/index.ts:
|
|
2445
|
+
[epub/index.ts:431](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L431)
|
|
2258
2446
|
|
|
2259
2447
|
Given an XMLElement, return its tag name.
|
|
2260
2448
|
|
|
@@ -2279,7 +2467,7 @@ Given an XMLElement, return its tag name.
|
|
|
2279
2467
|
> `static` **isXmlTextNode**(`node`): `node is XmlTextNode`
|
|
2280
2468
|
|
|
2281
2469
|
Defined in:
|
|
2282
|
-
[epub/index.ts:
|
|
2470
|
+
[epub/index.ts:506](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L506)
|
|
2283
2471
|
|
|
2284
2472
|
Given an XMLNode, determine whether it represents a text node or an XML element.
|
|
2285
2473
|
|
|
@@ -2298,7 +2486,7 @@ Given an XMLNode, determine whether it represents a text node or an XML element.
|
|
|
2298
2486
|
> `static` **replaceXmlChildren**\<`Name`\>(`element`, `children`): `void`
|
|
2299
2487
|
|
|
2300
2488
|
Defined in:
|
|
2301
|
-
[epub/index.ts:
|
|
2489
|
+
[epub/index.ts:454](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L454)
|
|
2302
2490
|
|
|
2303
2491
|
##### Type Parameters
|
|
2304
2492
|
|
|
@@ -2322,10 +2510,220 @@ Defined in:
|
|
|
2322
2510
|
> `static` **upgrade**(`path`, `options`): `Promise`\<[`Epub`](#epub)\>
|
|
2323
2511
|
|
|
2324
2512
|
Defined in:
|
|
2325
|
-
[epub/index.ts:
|
|
2513
|
+
[epub/index.ts:2988](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2988)
|
|
2326
2514
|
|
|
2327
2515
|
Upgrade an EPUB 2 publication to EPUB 3 in place, returning a new, valid Epub 3
|
|
2328
|
-
instance.
|
|
2516
|
+
instance. Equivalent to `Epub.using(TmpFsAdapter).upgrade(...)`.
|
|
2517
|
+
|
|
2518
|
+
##### Parameters
|
|
2519
|
+
|
|
2520
|
+
| Parameter | Type |
|
|
2521
|
+
| --------- | --------------------------------------------- |
|
|
2522
|
+
| `path` | `string` |
|
|
2523
|
+
| `options` | [`Epub2UpgradeOptions`](#epub2upgradeoptions) |
|
|
2524
|
+
|
|
2525
|
+
##### Returns
|
|
2526
|
+
|
|
2527
|
+
`Promise`\<[`Epub`](#epub)\>
|
|
2528
|
+
|
|
2529
|
+
#### using()
|
|
2530
|
+
|
|
2531
|
+
> `static` **using**\<`A`\>(`adapterClass`):
|
|
2532
|
+
> [`EpubFactory`](#epubfactory)\<`A`\>
|
|
2533
|
+
|
|
2534
|
+
Defined in:
|
|
2535
|
+
[epub/index.ts:588](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L588)
|
|
2536
|
+
|
|
2537
|
+
Specify the storage backend to use for the EPUB
|
|
2538
|
+
|
|
2539
|
+
The returned factory exposes `from`, `create`, and `upgrade`, which route
|
|
2540
|
+
through the supplied adapter.
|
|
2541
|
+
|
|
2542
|
+
##### Type Parameters
|
|
2543
|
+
|
|
2544
|
+
| Type Parameter |
|
|
2545
|
+
| ------------------------------------------------------------------------------- |
|
|
2546
|
+
| `A` _extends_ [`EpubStorageAdapterClass`](#epubstorageadapterclass)\<`object`\> |
|
|
2547
|
+
|
|
2548
|
+
##### Parameters
|
|
2549
|
+
|
|
2550
|
+
| Parameter | Type |
|
|
2551
|
+
| -------------- | ---- |
|
|
2552
|
+
| `adapterClass` | `A` |
|
|
2553
|
+
|
|
2554
|
+
##### Returns
|
|
2555
|
+
|
|
2556
|
+
[`EpubFactory`](#epubfactory)\<`A`\>
|
|
2557
|
+
|
|
2558
|
+
##### Example
|
|
2559
|
+
|
|
2560
|
+
```ts
|
|
2561
|
+
using epub = await Epub.using(TmpFsAdapter).from(path)
|
|
2562
|
+
using reader = await Epub.using(MemoryAdapter).from(buffer, { cache: false })
|
|
2563
|
+
```
|
|
2564
|
+
|
|
2565
|
+
---
|
|
2566
|
+
|
|
2567
|
+
## EpubFactory\<A\>
|
|
2568
|
+
|
|
2569
|
+
Defined in:
|
|
2570
|
+
[epub/index.ts:3017](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3017)
|
|
2571
|
+
|
|
2572
|
+
Adapter-bound factory returned by [Epub.using](#using).
|
|
2573
|
+
|
|
2574
|
+
Mirrors the static factory surface (`from`, `create`, `upgrade`) but routes all
|
|
2575
|
+
I/O through the supplied adapter. Each method's signature degrades gracefully
|
|
2576
|
+
when the adapter doesn't support the operation: `create` and `upgrade` throw at
|
|
2577
|
+
runtime if the adapter is read-only or lacks `initEmpty`.
|
|
2578
|
+
|
|
2579
|
+
### Type Parameters
|
|
2580
|
+
|
|
2581
|
+
| Type Parameter |
|
|
2582
|
+
| ------------------------------------------------------------------- |
|
|
2583
|
+
| `A` _extends_ [`EpubStorageAdapterClass`](#epubstorageadapterclass) |
|
|
2584
|
+
|
|
2585
|
+
### Constructors
|
|
2586
|
+
|
|
2587
|
+
#### Constructor
|
|
2588
|
+
|
|
2589
|
+
> **new EpubFactory**\<`A`\>(`adapterClass`):
|
|
2590
|
+
> [`EpubFactory`](#epubfactory)\<`A`\>
|
|
2591
|
+
|
|
2592
|
+
Defined in:
|
|
2593
|
+
[epub/index.ts:3018](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3018)
|
|
2594
|
+
|
|
2595
|
+
##### Parameters
|
|
2596
|
+
|
|
2597
|
+
| Parameter | Type |
|
|
2598
|
+
| -------------- | ---- |
|
|
2599
|
+
| `adapterClass` | `A` |
|
|
2600
|
+
|
|
2601
|
+
##### Returns
|
|
2602
|
+
|
|
2603
|
+
[`EpubFactory`](#epubfactory)\<`A`\>
|
|
2604
|
+
|
|
2605
|
+
### Properties
|
|
2606
|
+
|
|
2607
|
+
#### adapterClass
|
|
2608
|
+
|
|
2609
|
+
> `readonly` **adapterClass**: `A`
|
|
2610
|
+
|
|
2611
|
+
Defined in:
|
|
2612
|
+
[epub/index.ts:3018](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3018)
|
|
2613
|
+
|
|
2614
|
+
### Methods
|
|
2615
|
+
|
|
2616
|
+
#### create()
|
|
2617
|
+
|
|
2618
|
+
> **create**(`path`, `__namedParameters`, `additionalMetadata`):
|
|
2619
|
+
> `Promise`\<[`EpubInstanceFor`](#epubinstancefor)\<`A`\>\>
|
|
2620
|
+
|
|
2621
|
+
Defined in:
|
|
2622
|
+
[epub/index.ts:3074](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3074)
|
|
2623
|
+
|
|
2624
|
+
Construct a new EPUB on this factory's adapter, optionally seeded with the
|
|
2625
|
+
provided metadata. Requires a writable adapter that implements `initEmpty`
|
|
2626
|
+
(today: [TmpFsAdapter](#tmpfsadapter)).
|
|
2627
|
+
|
|
2628
|
+
##### Parameters
|
|
2629
|
+
|
|
2630
|
+
| Parameter | Type | Default value |
|
|
2631
|
+
| -------------------- | ------------------------------- | ------------- |
|
|
2632
|
+
| `path` | `string` | `undefined` |
|
|
2633
|
+
| `__namedParameters` | [`DublinCore`](#dublincore) | `undefined` |
|
|
2634
|
+
| `additionalMetadata` | [`EpubMetadata`](#epubmetadata) | `[]` |
|
|
2635
|
+
|
|
2636
|
+
##### Returns
|
|
2637
|
+
|
|
2638
|
+
`Promise`\<[`EpubInstanceFor`](#epubinstancefor)\<`A`\>\>
|
|
2639
|
+
|
|
2640
|
+
##### Throws
|
|
2641
|
+
|
|
2642
|
+
when the adapter is read-only or does not implement initEmpty
|
|
2643
|
+
|
|
2644
|
+
#### from()
|
|
2645
|
+
|
|
2646
|
+
##### Call Signature
|
|
2647
|
+
|
|
2648
|
+
> **from**(`source`, `options`): `Promise`\<`Pick`\<[`Epub`](#epub), `"storage"`
|
|
2649
|
+
> \| `"getManifest"` \| `"getVersion"` \| `"getLayout"` \| `"getBaseDirection"`
|
|
2650
|
+
> \| `"getMetadata"` \| `"findMetadataItem"` \| `"findAllMetadataItems"` \|
|
|
2651
|
+
> `"getIdentifier"` \| `"getTitle"` \| `"getSubtitle"` \| `"getTitles"` \|
|
|
2652
|
+
> `"getLanguage"` \| `"getPublicationDate"` \| `"getModifiedDate"` \|
|
|
2653
|
+
> `"getDescription"` \| `"getType"` \| `"getCreators"` \| `"getContributors"` \|
|
|
2654
|
+
> `"getSubjects"` \| `"getCollections"` \| `"getPackageVocabularyPrefixes"` \|
|
|
2655
|
+
> `"getCoverImageItem"` \| `"getCoverImage"` \| `"getSpineItems"` \|
|
|
2656
|
+
> `"getNcxTableOfContents"` \| `"getGuideEntries"` \| `"getTableOfContents"` \|
|
|
2657
|
+
> `"getLandmarks"` \| `"getPageList"` \| `"resolveHref"` \| `"readFileContents"`
|
|
2658
|
+
> \| `"readItemContents"` \| `"readXhtmlItemContents"` \|
|
|
2659
|
+
> `"getItemArchiveLength"` \| `"discardAndClose"`\> & `Disposable` & `object`\>
|
|
2660
|
+
|
|
2661
|
+
Defined in:
|
|
2662
|
+
[epub/index.ts:3025](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3025)
|
|
2663
|
+
|
|
2664
|
+
Open an existing EPUB through this factory's adapter
|
|
2665
|
+
|
|
2666
|
+
###### Parameters
|
|
2667
|
+
|
|
2668
|
+
| Parameter | Type |
|
|
2669
|
+
| --------- | ------------------------------------------------------------------------------------- |
|
|
2670
|
+
| `source` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
2671
|
+
| `options` | [`FromOptions`](#fromoptions) & `object` & [`AdapterOptions`](#adapteroptions)\<`A`\> |
|
|
2672
|
+
|
|
2673
|
+
###### Returns
|
|
2674
|
+
|
|
2675
|
+
`Promise`\<`Pick`\<[`Epub`](#epub), `"storage"` \| `"getManifest"` \|
|
|
2676
|
+
`"getVersion"` \| `"getLayout"` \| `"getBaseDirection"` \| `"getMetadata"` \|
|
|
2677
|
+
`"findMetadataItem"` \| `"findAllMetadataItems"` \| `"getIdentifier"` \|
|
|
2678
|
+
`"getTitle"` \| `"getSubtitle"` \| `"getTitles"` \| `"getLanguage"` \|
|
|
2679
|
+
`"getPublicationDate"` \| `"getModifiedDate"` \| `"getDescription"` \|
|
|
2680
|
+
`"getType"` \| `"getCreators"` \| `"getContributors"` \| `"getSubjects"` \|
|
|
2681
|
+
`"getCollections"` \| `"getPackageVocabularyPrefixes"` \| `"getCoverImageItem"`
|
|
2682
|
+
\| `"getCoverImage"` \| `"getSpineItems"` \| `"getNcxTableOfContents"` \|
|
|
2683
|
+
`"getGuideEntries"` \| `"getTableOfContents"` \| `"getLandmarks"` \|
|
|
2684
|
+
`"getPageList"` \| `"resolveHref"` \| `"readFileContents"` \|
|
|
2685
|
+
`"readItemContents"` \| `"readXhtmlItemContents"` \| `"getItemArchiveLength"` \|
|
|
2686
|
+
`"discardAndClose"`\> & `Disposable` & `object`\>
|
|
2687
|
+
|
|
2688
|
+
###### Throws
|
|
2689
|
+
|
|
2690
|
+
when the archive is not a valid EPUB 3
|
|
2691
|
+
|
|
2692
|
+
##### Call Signature
|
|
2693
|
+
|
|
2694
|
+
> **from**(`source`, `options?`):
|
|
2695
|
+
> `Promise`\<[`EpubInstanceFor`](#epubinstancefor)\<`A`\> & `object`\>
|
|
2696
|
+
|
|
2697
|
+
Defined in:
|
|
2698
|
+
[epub/index.ts:3029](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3029)
|
|
2699
|
+
|
|
2700
|
+
Open an existing EPUB through this factory's adapter
|
|
2701
|
+
|
|
2702
|
+
###### Parameters
|
|
2703
|
+
|
|
2704
|
+
| Parameter | Type |
|
|
2705
|
+
| ---------- | -------------------------------------------------------------------------- |
|
|
2706
|
+
| `source` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
2707
|
+
| `options?` | [`FromOptions`](#fromoptions) & [`AdapterOptions`](#adapteroptions)\<`A`\> |
|
|
2708
|
+
|
|
2709
|
+
###### Returns
|
|
2710
|
+
|
|
2711
|
+
`Promise`\<[`EpubInstanceFor`](#epubinstancefor)\<`A`\> & `object`\>
|
|
2712
|
+
|
|
2713
|
+
###### Throws
|
|
2714
|
+
|
|
2715
|
+
when the archive is not a valid EPUB 3
|
|
2716
|
+
|
|
2717
|
+
#### upgrade()
|
|
2718
|
+
|
|
2719
|
+
> **upgrade**(`path`, `options`):
|
|
2720
|
+
> `Promise`\<[`EpubInstanceFor`](#epubinstancefor)\<`A`\>\>
|
|
2721
|
+
|
|
2722
|
+
Defined in:
|
|
2723
|
+
[epub/index.ts:3187](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L3187)
|
|
2724
|
+
|
|
2725
|
+
Upgrade an EPUB 2 publication to EPUB 3 in place using this factory's adapter,
|
|
2726
|
+
returning a new, valid Epub 3 instance.
|
|
2329
2727
|
|
|
2330
2728
|
Performs the following transformations:
|
|
2331
2729
|
|
|
@@ -2338,6 +2736,11 @@ Performs the following transformations:
|
|
|
2338
2736
|
- goes over each xhtml item and rewrites it using XMLParser to make sure the
|
|
2339
2737
|
output is valid XHTML
|
|
2340
2738
|
|
|
2739
|
+
Requires a writable adapter. When
|
|
2740
|
+
[Upgrade.Epub2UpgradeOptions.outputPath](#outputpath) is set, the source file is
|
|
2741
|
+
copied to that path on disk first; this only makes sense for adapters whose
|
|
2742
|
+
`source` is a real fs path.
|
|
2743
|
+
|
|
2341
2744
|
##### Parameters
|
|
2342
2745
|
|
|
2343
2746
|
| Parameter | Type |
|
|
@@ -2347,14 +2750,18 @@ Performs the following transformations:
|
|
|
2347
2750
|
|
|
2348
2751
|
##### Returns
|
|
2349
2752
|
|
|
2350
|
-
`Promise`\<[`
|
|
2753
|
+
`Promise`\<[`EpubInstanceFor`](#epubinstancefor)\<`A`\>\>
|
|
2754
|
+
|
|
2755
|
+
##### Throws
|
|
2756
|
+
|
|
2757
|
+
when the adapter is read-only
|
|
2351
2758
|
|
|
2352
2759
|
---
|
|
2353
2760
|
|
|
2354
|
-
##
|
|
2761
|
+
## EpubReadOnlyError
|
|
2355
2762
|
|
|
2356
2763
|
Defined in:
|
|
2357
|
-
[epub/index.ts:
|
|
2764
|
+
[epub/index.ts:238](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L238)
|
|
2358
2765
|
|
|
2359
2766
|
### Extends
|
|
2360
2767
|
|
|
@@ -2364,7 +2771,8 @@ Defined in:
|
|
|
2364
2771
|
|
|
2365
2772
|
#### Constructor
|
|
2366
2773
|
|
|
2367
|
-
> **new
|
|
2774
|
+
> **new EpubReadOnlyError**(`message?`):
|
|
2775
|
+
> [`EpubReadOnlyError`](#epubreadonlyerror)
|
|
2368
2776
|
|
|
2369
2777
|
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
2370
2778
|
|
|
@@ -2376,7 +2784,7 @@ Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
|
2376
2784
|
|
|
2377
2785
|
##### Returns
|
|
2378
2786
|
|
|
2379
|
-
[`
|
|
2787
|
+
[`EpubReadOnlyError`](#epubreadonlyerror)
|
|
2380
2788
|
|
|
2381
2789
|
##### Inherited from
|
|
2382
2790
|
|
|
@@ -2384,8 +2792,8 @@ Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
|
2384
2792
|
|
|
2385
2793
|
#### Constructor
|
|
2386
2794
|
|
|
2387
|
-
> **new
|
|
2388
|
-
> [`
|
|
2795
|
+
> **new EpubReadOnlyError**(`message?`, `options?`):
|
|
2796
|
+
> [`EpubReadOnlyError`](#epubreadonlyerror)
|
|
2389
2797
|
|
|
2390
2798
|
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
2391
2799
|
|
|
@@ -2398,7 +2806,7 @@ Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
|
2398
2806
|
|
|
2399
2807
|
##### Returns
|
|
2400
2808
|
|
|
2401
|
-
[`
|
|
2809
|
+
[`EpubReadOnlyError`](#epubreadonlyerror)
|
|
2402
2810
|
|
|
2403
2811
|
##### Inherited from
|
|
2404
2812
|
|
|
@@ -2582,63 +2990,747 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
2582
2990
|
|
|
2583
2991
|
---
|
|
2584
2992
|
|
|
2585
|
-
##
|
|
2993
|
+
## EpubVersionError
|
|
2586
2994
|
|
|
2587
2995
|
Defined in:
|
|
2588
|
-
[epub/index.ts:
|
|
2996
|
+
[epub/index.ts:237](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L237)
|
|
2589
2997
|
|
|
2590
|
-
###
|
|
2998
|
+
### Extends
|
|
2591
2999
|
|
|
2592
|
-
|
|
3000
|
+
- `Error`
|
|
2593
3001
|
|
|
2594
|
-
|
|
3002
|
+
### Constructors
|
|
2595
3003
|
|
|
2596
|
-
|
|
2597
|
-
[epub/index.ts:112](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L112)
|
|
3004
|
+
#### Constructor
|
|
2598
3005
|
|
|
2599
|
-
|
|
3006
|
+
> **new EpubVersionError**(`message?`): [`EpubVersionError`](#epubversionerror)
|
|
2600
3007
|
|
|
2601
|
-
|
|
3008
|
+
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
2602
3009
|
|
|
2603
|
-
|
|
2604
|
-
[epub/index.ts:111](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L111)
|
|
3010
|
+
##### Parameters
|
|
2605
3011
|
|
|
2606
|
-
|
|
3012
|
+
| Parameter | Type |
|
|
3013
|
+
| ---------- | -------- |
|
|
3014
|
+
| `message?` | `string` |
|
|
2607
3015
|
|
|
2608
|
-
|
|
3016
|
+
##### Returns
|
|
2609
3017
|
|
|
2610
|
-
|
|
2611
|
-
|
|
3018
|
+
[`EpubVersionError`](#epubversionerror)
|
|
3019
|
+
|
|
3020
|
+
##### Inherited from
|
|
3021
|
+
|
|
3022
|
+
`Error.constructor`
|
|
3023
|
+
|
|
3024
|
+
#### Constructor
|
|
3025
|
+
|
|
3026
|
+
> **new EpubVersionError**(`message?`, `options?`):
|
|
3027
|
+
> [`EpubVersionError`](#epubversionerror)
|
|
3028
|
+
|
|
3029
|
+
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1082
|
|
3030
|
+
|
|
3031
|
+
##### Parameters
|
|
3032
|
+
|
|
3033
|
+
| Parameter | Type |
|
|
3034
|
+
| ---------- | -------------- |
|
|
3035
|
+
| `message?` | `string` |
|
|
3036
|
+
| `options?` | `ErrorOptions` |
|
|
3037
|
+
|
|
3038
|
+
##### Returns
|
|
3039
|
+
|
|
3040
|
+
[`EpubVersionError`](#epubversionerror)
|
|
3041
|
+
|
|
3042
|
+
##### Inherited from
|
|
3043
|
+
|
|
3044
|
+
`Error.constructor`
|
|
3045
|
+
|
|
3046
|
+
### Properties
|
|
3047
|
+
|
|
3048
|
+
#### cause?
|
|
3049
|
+
|
|
3050
|
+
> `optional` **cause**: `unknown`
|
|
3051
|
+
|
|
3052
|
+
Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26
|
|
3053
|
+
|
|
3054
|
+
##### Inherited from
|
|
3055
|
+
|
|
3056
|
+
`Error.cause`
|
|
3057
|
+
|
|
3058
|
+
#### message
|
|
3059
|
+
|
|
3060
|
+
> **message**: `string`
|
|
3061
|
+
|
|
3062
|
+
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077
|
|
3063
|
+
|
|
3064
|
+
##### Inherited from
|
|
3065
|
+
|
|
3066
|
+
`Error.message`
|
|
3067
|
+
|
|
3068
|
+
#### name
|
|
3069
|
+
|
|
3070
|
+
> **name**: `string`
|
|
3071
|
+
|
|
3072
|
+
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076
|
|
3073
|
+
|
|
3074
|
+
##### Inherited from
|
|
3075
|
+
|
|
3076
|
+
`Error.name`
|
|
3077
|
+
|
|
3078
|
+
#### stack?
|
|
3079
|
+
|
|
3080
|
+
> `optional` **stack**: `string`
|
|
3081
|
+
|
|
3082
|
+
Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078
|
|
3083
|
+
|
|
3084
|
+
##### Inherited from
|
|
3085
|
+
|
|
3086
|
+
`Error.stack`
|
|
3087
|
+
|
|
3088
|
+
#### stackTraceLimit
|
|
3089
|
+
|
|
3090
|
+
> `static` **stackTraceLimit**: `number`
|
|
3091
|
+
|
|
3092
|
+
Defined in: node_modules/@types/node/globals.d.ts:68
|
|
3093
|
+
|
|
3094
|
+
The `Error.stackTraceLimit` property specifies the number of stack frames
|
|
3095
|
+
collected by a stack trace (whether generated by `new Error().stack` or
|
|
3096
|
+
`Error.captureStackTrace(obj)`).
|
|
3097
|
+
|
|
3098
|
+
The default value is `10` but may be set to any valid JavaScript number. Changes
|
|
3099
|
+
will affect any stack trace captured _after_ the value has been changed.
|
|
3100
|
+
|
|
3101
|
+
If set to a non-number value, or set to a negative number, stack traces will not
|
|
3102
|
+
capture any frames.
|
|
3103
|
+
|
|
3104
|
+
##### Inherited from
|
|
3105
|
+
|
|
3106
|
+
`Error.stackTraceLimit`
|
|
3107
|
+
|
|
3108
|
+
### Methods
|
|
3109
|
+
|
|
3110
|
+
#### captureStackTrace()
|
|
3111
|
+
|
|
3112
|
+
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
3113
|
+
|
|
3114
|
+
Defined in: node_modules/@types/node/globals.d.ts:52
|
|
3115
|
+
|
|
3116
|
+
Creates a `.stack` property on `targetObject`, which when accessed returns a
|
|
3117
|
+
string representing the location in the code at which
|
|
3118
|
+
`Error.captureStackTrace()` was called.
|
|
3119
|
+
|
|
3120
|
+
```js
|
|
3121
|
+
const myObject = {}
|
|
3122
|
+
Error.captureStackTrace(myObject)
|
|
3123
|
+
myObject.stack // Similar to `new Error().stack`
|
|
3124
|
+
```
|
|
3125
|
+
|
|
3126
|
+
The first line of the trace will be prefixed with
|
|
3127
|
+
`${myObject.name}: ${myObject.message}`.
|
|
3128
|
+
|
|
3129
|
+
The optional `constructorOpt` argument accepts a function. If given, all frames
|
|
3130
|
+
above `constructorOpt`, including `constructorOpt`, will be omitted from the
|
|
3131
|
+
generated stack trace.
|
|
3132
|
+
|
|
3133
|
+
The `constructorOpt` argument is useful for hiding implementation details of
|
|
3134
|
+
error generation from the user. For instance:
|
|
3135
|
+
|
|
3136
|
+
```js
|
|
3137
|
+
function a() {
|
|
3138
|
+
b()
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
function b() {
|
|
3142
|
+
c()
|
|
3143
|
+
}
|
|
3144
|
+
|
|
3145
|
+
function c() {
|
|
3146
|
+
// Create an error without stack trace to avoid calculating the stack trace twice.
|
|
3147
|
+
const { stackTraceLimit } = Error
|
|
3148
|
+
Error.stackTraceLimit = 0
|
|
3149
|
+
const error = new Error()
|
|
3150
|
+
Error.stackTraceLimit = stackTraceLimit
|
|
3151
|
+
|
|
3152
|
+
// Capture the stack trace above function b
|
|
3153
|
+
Error.captureStackTrace(error, b) // Neither function c, nor b is included in the stack trace
|
|
3154
|
+
throw error
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
a()
|
|
3158
|
+
```
|
|
3159
|
+
|
|
3160
|
+
##### Parameters
|
|
3161
|
+
|
|
3162
|
+
| Parameter | Type |
|
|
3163
|
+
| ----------------- | ---------- |
|
|
3164
|
+
| `targetObject` | `object` |
|
|
3165
|
+
| `constructorOpt?` | `Function` |
|
|
3166
|
+
|
|
3167
|
+
##### Returns
|
|
3168
|
+
|
|
3169
|
+
`void`
|
|
3170
|
+
|
|
3171
|
+
##### Inherited from
|
|
3172
|
+
|
|
3173
|
+
`Error.captureStackTrace`
|
|
3174
|
+
|
|
3175
|
+
#### isError()
|
|
3176
|
+
|
|
3177
|
+
> `static` **isError**(`error`): `error is Error`
|
|
3178
|
+
|
|
3179
|
+
Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:23
|
|
3180
|
+
|
|
3181
|
+
Indicates whether the argument provided is a built-in Error instance or not.
|
|
3182
|
+
|
|
3183
|
+
##### Parameters
|
|
3184
|
+
|
|
3185
|
+
| Parameter | Type |
|
|
3186
|
+
| --------- | --------- |
|
|
3187
|
+
| `error` | `unknown` |
|
|
3188
|
+
|
|
3189
|
+
##### Returns
|
|
3190
|
+
|
|
3191
|
+
`error is Error`
|
|
3192
|
+
|
|
3193
|
+
##### Inherited from
|
|
3194
|
+
|
|
3195
|
+
`Error.isError`
|
|
3196
|
+
|
|
3197
|
+
#### prepareStackTrace()
|
|
3198
|
+
|
|
3199
|
+
> `static` **prepareStackTrace**(`err`, `stackTraces`): `any`
|
|
3200
|
+
|
|
3201
|
+
Defined in: node_modules/@types/node/globals.d.ts:56
|
|
3202
|
+
|
|
3203
|
+
##### Parameters
|
|
3204
|
+
|
|
3205
|
+
| Parameter | Type |
|
|
3206
|
+
| ------------- | ------------ |
|
|
3207
|
+
| `err` | `Error` |
|
|
3208
|
+
| `stackTraces` | `CallSite`[] |
|
|
3209
|
+
|
|
3210
|
+
##### Returns
|
|
3211
|
+
|
|
3212
|
+
`any`
|
|
3213
|
+
|
|
3214
|
+
##### See
|
|
3215
|
+
|
|
3216
|
+
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
3217
|
+
|
|
3218
|
+
##### Inherited from
|
|
3219
|
+
|
|
3220
|
+
`Error.prepareStackTrace`
|
|
3221
|
+
|
|
3222
|
+
---
|
|
3223
|
+
|
|
3224
|
+
## MemoryAdapter
|
|
3225
|
+
|
|
3226
|
+
Defined in:
|
|
3227
|
+
[epub/adapters/memory.ts:32](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L32)
|
|
3228
|
+
|
|
3229
|
+
Loads an EPUB archive into memory and serves all I/O off the in-memory zip
|
|
3230
|
+
handle.
|
|
3231
|
+
|
|
3232
|
+
read only
|
|
3233
|
+
|
|
3234
|
+
### Implements
|
|
3235
|
+
|
|
3236
|
+
- [`EpubStorageAdapter`](#epubstorageadapter)
|
|
3237
|
+
|
|
3238
|
+
### Properties
|
|
3239
|
+
|
|
3240
|
+
#### rootPath
|
|
3241
|
+
|
|
3242
|
+
> `readonly` **rootPath**: `string`
|
|
3243
|
+
|
|
3244
|
+
Defined in:
|
|
3245
|
+
[epub/adapters/memory.ts:71](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L71)
|
|
3246
|
+
|
|
3247
|
+
Opaque path prefix used by `resolveInternalHref` to anchor absolute paths within
|
|
3248
|
+
the archive. For TmpFsAdapter this is the tmp dir; for MemoryAdapter it's a
|
|
3249
|
+
virtual prefix that's never written to disk
|
|
3250
|
+
|
|
3251
|
+
##### Implementation of
|
|
3252
|
+
|
|
3253
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`rootPath`](#rootpath-2)
|
|
3254
|
+
|
|
3255
|
+
#### capabilities
|
|
3256
|
+
|
|
3257
|
+
> `readonly` `static` **capabilities**: `object`
|
|
3258
|
+
|
|
3259
|
+
Defined in:
|
|
3260
|
+
[epub/adapters/memory.ts:34](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L34)
|
|
3261
|
+
|
|
3262
|
+
##### writable
|
|
3263
|
+
|
|
3264
|
+
> `readonly` **writable**: `false` = `false`
|
|
3265
|
+
|
|
3266
|
+
#### kind
|
|
3267
|
+
|
|
3268
|
+
> `readonly` `static` **kind**: `"in-memory"`
|
|
3269
|
+
|
|
3270
|
+
Defined in:
|
|
3271
|
+
[epub/adapters/memory.ts:33](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L33)
|
|
3272
|
+
|
|
3273
|
+
### Methods
|
|
3274
|
+
|
|
3275
|
+
#### archiveLength()
|
|
3276
|
+
|
|
3277
|
+
> **archiveLength**(`path`): `Promise`\<`number`\>
|
|
3278
|
+
|
|
3279
|
+
Defined in:
|
|
3280
|
+
[epub/adapters/memory.ts:114](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L114)
|
|
3281
|
+
|
|
3282
|
+
Length of an entry in bytes, for the readium page-count heuristic which expects
|
|
3283
|
+
compressed size when available
|
|
3284
|
+
|
|
3285
|
+
##### Parameters
|
|
3286
|
+
|
|
3287
|
+
| Parameter | Type |
|
|
3288
|
+
| --------- | -------- |
|
|
3289
|
+
| `path` | `string` |
|
|
3290
|
+
|
|
3291
|
+
##### Returns
|
|
3292
|
+
|
|
3293
|
+
`Promise`\<`number`\>
|
|
3294
|
+
|
|
3295
|
+
##### Implementation of
|
|
3296
|
+
|
|
3297
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`archiveLength`](#archivelength-4)
|
|
3298
|
+
|
|
3299
|
+
#### dispose()
|
|
3300
|
+
|
|
3301
|
+
> **dispose**(): `void`
|
|
3302
|
+
|
|
3303
|
+
Defined in:
|
|
3304
|
+
[epub/adapters/memory.ts:120](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L120)
|
|
3305
|
+
|
|
3306
|
+
Always called on close or error
|
|
3307
|
+
|
|
3308
|
+
##### Returns
|
|
3309
|
+
|
|
3310
|
+
`void`
|
|
3311
|
+
|
|
3312
|
+
##### Implementation of
|
|
3313
|
+
|
|
3314
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`dispose`](#dispose-6)
|
|
3315
|
+
|
|
3316
|
+
#### read()
|
|
3317
|
+
|
|
3318
|
+
##### Call Signature
|
|
3319
|
+
|
|
3320
|
+
> **read**(`path`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
3321
|
+
|
|
3322
|
+
Defined in:
|
|
3323
|
+
[epub/adapters/memory.ts:85](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L85)
|
|
3324
|
+
|
|
3325
|
+
###### Parameters
|
|
3326
|
+
|
|
3327
|
+
| Parameter | Type |
|
|
3328
|
+
| --------- | -------- |
|
|
3329
|
+
| `path` | `string` |
|
|
3330
|
+
|
|
3331
|
+
###### Returns
|
|
3332
|
+
|
|
3333
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
3334
|
+
|
|
3335
|
+
###### Implementation of
|
|
3336
|
+
|
|
3337
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`read`](#read-6)
|
|
3338
|
+
|
|
3339
|
+
##### Call Signature
|
|
3340
|
+
|
|
3341
|
+
> **read**(`path`, `encoding`): `Promise`\<`string`\>
|
|
3342
|
+
|
|
3343
|
+
Defined in:
|
|
3344
|
+
[epub/adapters/memory.ts:86](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L86)
|
|
3345
|
+
|
|
3346
|
+
###### Parameters
|
|
3347
|
+
|
|
3348
|
+
| Parameter | Type |
|
|
3349
|
+
| ---------- | --------- |
|
|
3350
|
+
| `path` | `string` |
|
|
3351
|
+
| `encoding` | `"utf-8"` |
|
|
3352
|
+
|
|
3353
|
+
###### Returns
|
|
3354
|
+
|
|
3355
|
+
`Promise`\<`string`\>
|
|
3356
|
+
|
|
3357
|
+
###### Implementation of
|
|
3358
|
+
|
|
3359
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`read`](#read-6)
|
|
3360
|
+
|
|
3361
|
+
#### init()
|
|
3362
|
+
|
|
3363
|
+
> `static` **init**(`source`, `opts`):
|
|
3364
|
+
> `Promise`\<[`MemoryAdapter`](#memoryadapter)\>
|
|
3365
|
+
|
|
3366
|
+
Defined in:
|
|
3367
|
+
[epub/adapters/memory.ts:36](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L36)
|
|
3368
|
+
|
|
3369
|
+
##### Parameters
|
|
3370
|
+
|
|
3371
|
+
| Parameter | Type |
|
|
3372
|
+
| --------- | ----------------------------------------------- |
|
|
3373
|
+
| `source` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
3374
|
+
| `opts` | [`MemoryAdapterOptions`](#memoryadapteroptions) |
|
|
3375
|
+
|
|
3376
|
+
##### Returns
|
|
3377
|
+
|
|
3378
|
+
`Promise`\<[`MemoryAdapter`](#memoryadapter)\>
|
|
3379
|
+
|
|
3380
|
+
---
|
|
3381
|
+
|
|
3382
|
+
## TmpFsAdapter
|
|
3383
|
+
|
|
3384
|
+
Defined in:
|
|
3385
|
+
[epub/adapters/tmpfs.ts:59](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L59)
|
|
3386
|
+
|
|
3387
|
+
Extracts an EPUB archive to a temp directory and serves all I/O off the real
|
|
3388
|
+
filesystem. `Epub.using(TmpFsAdapter).from(...)` returns a writable
|
|
3389
|
+
[Epub](#epub).
|
|
3390
|
+
|
|
3391
|
+
### Implements
|
|
3392
|
+
|
|
3393
|
+
- [`EpubStorageAdapter`](#epubstorageadapter)
|
|
3394
|
+
|
|
3395
|
+
### Properties
|
|
3396
|
+
|
|
3397
|
+
#### rootPath
|
|
3398
|
+
|
|
3399
|
+
> `readonly` **rootPath**: `string`
|
|
3400
|
+
|
|
3401
|
+
Defined in:
|
|
3402
|
+
[epub/adapters/tmpfs.ts:102](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L102)
|
|
3403
|
+
|
|
3404
|
+
Opaque path prefix used by `resolveInternalHref` to anchor absolute paths within
|
|
3405
|
+
the archive. For TmpFsAdapter this is the tmp dir; for MemoryAdapter it's a
|
|
3406
|
+
virtual prefix that's never written to disk
|
|
3407
|
+
|
|
3408
|
+
##### Implementation of
|
|
3409
|
+
|
|
3410
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`rootPath`](#rootpath-2)
|
|
3411
|
+
|
|
3412
|
+
#### capabilities
|
|
3413
|
+
|
|
3414
|
+
> `readonly` `static` **capabilities**: `object`
|
|
3415
|
+
|
|
3416
|
+
Defined in:
|
|
3417
|
+
[epub/adapters/tmpfs.ts:61](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L61)
|
|
3418
|
+
|
|
3419
|
+
##### writable
|
|
3420
|
+
|
|
3421
|
+
> `readonly` **writable**: `true` = `true`
|
|
3422
|
+
|
|
3423
|
+
#### kind
|
|
3424
|
+
|
|
3425
|
+
> `readonly` `static` **kind**: `"extracted-dir"`
|
|
3426
|
+
|
|
3427
|
+
Defined in:
|
|
3428
|
+
[epub/adapters/tmpfs.ts:60](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L60)
|
|
3429
|
+
|
|
3430
|
+
### Methods
|
|
3431
|
+
|
|
3432
|
+
#### archiveLength()
|
|
3433
|
+
|
|
3434
|
+
> **archiveLength**(`path`): `Promise`\<`number`\>
|
|
3435
|
+
|
|
3436
|
+
Defined in:
|
|
3437
|
+
[epub/adapters/tmpfs.ts:125](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L125)
|
|
3438
|
+
|
|
3439
|
+
Length of an entry in bytes, for the readium page-count heuristic which expects
|
|
3440
|
+
compressed size when available
|
|
3441
|
+
|
|
3442
|
+
##### Parameters
|
|
3443
|
+
|
|
3444
|
+
| Parameter | Type |
|
|
3445
|
+
| --------- | -------- |
|
|
3446
|
+
| `path` | `string` |
|
|
3447
|
+
|
|
3448
|
+
##### Returns
|
|
3449
|
+
|
|
3450
|
+
`Promise`\<`number`\>
|
|
3451
|
+
|
|
3452
|
+
##### Implementation of
|
|
3453
|
+
|
|
3454
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`archiveLength`](#archivelength-4)
|
|
3455
|
+
|
|
3456
|
+
#### dispose()
|
|
3457
|
+
|
|
3458
|
+
> **dispose**(): `void`
|
|
3459
|
+
|
|
3460
|
+
Defined in:
|
|
3461
|
+
[epub/adapters/tmpfs.ts:198](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L198)
|
|
3462
|
+
|
|
3463
|
+
Always called on close or error
|
|
3464
|
+
|
|
3465
|
+
##### Returns
|
|
3466
|
+
|
|
3467
|
+
`void`
|
|
3468
|
+
|
|
3469
|
+
##### Implementation of
|
|
3470
|
+
|
|
3471
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`dispose`](#dispose-6)
|
|
3472
|
+
|
|
3473
|
+
#### duplicate()
|
|
3474
|
+
|
|
3475
|
+
> **duplicate**(): `Promise`\<[`TmpFsAdapter`](#tmpfsadapter)\>
|
|
3476
|
+
|
|
3477
|
+
Defined in:
|
|
3478
|
+
[epub/adapters/tmpfs.ts:149](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L149)
|
|
3479
|
+
|
|
3480
|
+
Required for Epub.copy
|
|
3481
|
+
|
|
3482
|
+
##### Returns
|
|
3483
|
+
|
|
3484
|
+
`Promise`\<[`TmpFsAdapter`](#tmpfsadapter)\>
|
|
3485
|
+
|
|
3486
|
+
##### Implementation of
|
|
3487
|
+
|
|
3488
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`duplicate`](#duplicate-2)
|
|
3489
|
+
|
|
3490
|
+
#### list()
|
|
3491
|
+
|
|
3492
|
+
> **list**(): `AsyncIterable`\<[`EpubListEntry`](#epublistentry)\>
|
|
3493
|
+
|
|
3494
|
+
Defined in:
|
|
3495
|
+
[epub/adapters/tmpfs.ts:134](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L134)
|
|
3496
|
+
|
|
3497
|
+
Required for Epub.saveAndClose to walk the contents
|
|
3498
|
+
|
|
3499
|
+
##### Returns
|
|
3500
|
+
|
|
3501
|
+
`AsyncIterable`\<[`EpubListEntry`](#epublistentry)\>
|
|
3502
|
+
|
|
3503
|
+
##### Implementation of
|
|
3504
|
+
|
|
3505
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`list`](#list-2)
|
|
3506
|
+
|
|
3507
|
+
#### read()
|
|
3508
|
+
|
|
3509
|
+
##### Call Signature
|
|
3510
|
+
|
|
3511
|
+
> **read**(`path`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
3512
|
+
|
|
3513
|
+
Defined in:
|
|
3514
|
+
[epub/adapters/tmpfs.ts:104](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L104)
|
|
3515
|
+
|
|
3516
|
+
###### Parameters
|
|
3517
|
+
|
|
3518
|
+
| Parameter | Type |
|
|
3519
|
+
| --------- | -------- |
|
|
3520
|
+
| `path` | `string` |
|
|
3521
|
+
|
|
3522
|
+
###### Returns
|
|
3523
|
+
|
|
3524
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
3525
|
+
|
|
3526
|
+
###### Implementation of
|
|
3527
|
+
|
|
3528
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`read`](#read-6)
|
|
3529
|
+
|
|
3530
|
+
##### Call Signature
|
|
3531
|
+
|
|
3532
|
+
> **read**(`path`, `encoding`): `Promise`\<`string`\>
|
|
3533
|
+
|
|
3534
|
+
Defined in:
|
|
3535
|
+
[epub/adapters/tmpfs.ts:105](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L105)
|
|
3536
|
+
|
|
3537
|
+
###### Parameters
|
|
3538
|
+
|
|
3539
|
+
| Parameter | Type |
|
|
3540
|
+
| ---------- | --------- |
|
|
3541
|
+
| `path` | `string` |
|
|
3542
|
+
| `encoding` | `"utf-8"` |
|
|
3543
|
+
|
|
3544
|
+
###### Returns
|
|
3545
|
+
|
|
3546
|
+
`Promise`\<`string`\>
|
|
3547
|
+
|
|
3548
|
+
###### Implementation of
|
|
3549
|
+
|
|
3550
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`read`](#read-6)
|
|
3551
|
+
|
|
3552
|
+
#### remove()
|
|
3553
|
+
|
|
3554
|
+
> **remove**(`path`): `Promise`\<`void`\>
|
|
3555
|
+
|
|
3556
|
+
Defined in:
|
|
3557
|
+
[epub/adapters/tmpfs.ts:121](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L121)
|
|
3558
|
+
|
|
3559
|
+
Required for removeManifestItem / setCoverImage replacement
|
|
3560
|
+
|
|
3561
|
+
##### Parameters
|
|
3562
|
+
|
|
3563
|
+
| Parameter | Type |
|
|
3564
|
+
| --------- | -------- |
|
|
3565
|
+
| `path` | `string` |
|
|
3566
|
+
|
|
3567
|
+
##### Returns
|
|
3568
|
+
|
|
3569
|
+
`Promise`\<`void`\>
|
|
3570
|
+
|
|
3571
|
+
##### Implementation of
|
|
3572
|
+
|
|
3573
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`remove`](#remove-2)
|
|
3574
|
+
|
|
3575
|
+
#### serialize()
|
|
3576
|
+
|
|
3577
|
+
> **serialize**(`targetPath`): `Promise`\<`void`\>
|
|
3578
|
+
|
|
3579
|
+
Defined in:
|
|
3580
|
+
[epub/adapters/tmpfs.ts:160](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L160)
|
|
3581
|
+
|
|
3582
|
+
Required for Epub.saveAndClose
|
|
3583
|
+
|
|
3584
|
+
##### Parameters
|
|
3585
|
+
|
|
3586
|
+
| Parameter | Type |
|
|
3587
|
+
| ------------ | -------- |
|
|
3588
|
+
| `targetPath` | `string` |
|
|
3589
|
+
|
|
3590
|
+
##### Returns
|
|
3591
|
+
|
|
3592
|
+
`Promise`\<`void`\>
|
|
3593
|
+
|
|
3594
|
+
##### Implementation of
|
|
3595
|
+
|
|
3596
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`serialize`](#serialize-2)
|
|
3597
|
+
|
|
3598
|
+
#### write()
|
|
3599
|
+
|
|
3600
|
+
##### Call Signature
|
|
3601
|
+
|
|
3602
|
+
> **write**(`path`, `data`): `Promise`\<`void`\>
|
|
3603
|
+
|
|
3604
|
+
Defined in:
|
|
3605
|
+
[epub/adapters/tmpfs.ts:110](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L110)
|
|
3606
|
+
|
|
3607
|
+
Required for any mutation method on Epub
|
|
3608
|
+
|
|
3609
|
+
###### Parameters
|
|
3610
|
+
|
|
3611
|
+
| Parameter | Type |
|
|
3612
|
+
| --------- | ------------ |
|
|
3613
|
+
| `path` | `string` |
|
|
3614
|
+
| `data` | `Uint8Array` |
|
|
3615
|
+
|
|
3616
|
+
###### Returns
|
|
3617
|
+
|
|
3618
|
+
`Promise`\<`void`\>
|
|
3619
|
+
|
|
3620
|
+
###### Implementation of
|
|
3621
|
+
|
|
3622
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`write`](#write-3)
|
|
3623
|
+
|
|
3624
|
+
##### Call Signature
|
|
3625
|
+
|
|
3626
|
+
> **write**(`path`, `data`, `encoding`): `Promise`\<`void`\>
|
|
3627
|
+
|
|
3628
|
+
Defined in:
|
|
3629
|
+
[epub/adapters/tmpfs.ts:111](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L111)
|
|
3630
|
+
|
|
3631
|
+
###### Parameters
|
|
3632
|
+
|
|
3633
|
+
| Parameter | Type |
|
|
3634
|
+
| ---------- | --------- |
|
|
3635
|
+
| `path` | `string` |
|
|
3636
|
+
| `data` | `string` |
|
|
3637
|
+
| `encoding` | `"utf-8"` |
|
|
3638
|
+
|
|
3639
|
+
###### Returns
|
|
3640
|
+
|
|
3641
|
+
`Promise`\<`void`\>
|
|
3642
|
+
|
|
3643
|
+
###### Implementation of
|
|
3644
|
+
|
|
3645
|
+
[`EpubStorageAdapter`](#epubstorageadapter).[`write`](#write-3)
|
|
3646
|
+
|
|
3647
|
+
#### init()
|
|
3648
|
+
|
|
3649
|
+
> `static` **init**(`source`): `Promise`\<[`TmpFsAdapter`](#tmpfsadapter)\>
|
|
3650
|
+
|
|
3651
|
+
Defined in:
|
|
3652
|
+
[epub/adapters/tmpfs.ts:63](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L63)
|
|
3653
|
+
|
|
3654
|
+
##### Parameters
|
|
3655
|
+
|
|
3656
|
+
| Parameter | Type |
|
|
3657
|
+
| --------- | --------------------------------------------- |
|
|
3658
|
+
| `source` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
3659
|
+
|
|
3660
|
+
##### Returns
|
|
3661
|
+
|
|
3662
|
+
`Promise`\<[`TmpFsAdapter`](#tmpfsadapter)\>
|
|
3663
|
+
|
|
3664
|
+
#### initEmpty()
|
|
3665
|
+
|
|
3666
|
+
> `static` **initEmpty**(): `Promise`\<[`TmpFsAdapter`](#tmpfsadapter)\>
|
|
3667
|
+
|
|
3668
|
+
Defined in:
|
|
3669
|
+
[epub/adapters/tmpfs.ts:96](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/tmpfs.ts#L96)
|
|
3670
|
+
|
|
3671
|
+
##### Returns
|
|
3672
|
+
|
|
3673
|
+
`Promise`\<[`TmpFsAdapter`](#tmpfsadapter)\>
|
|
3674
|
+
|
|
3675
|
+
---
|
|
3676
|
+
|
|
3677
|
+
## AlternateScript
|
|
3678
|
+
|
|
3679
|
+
Defined in:
|
|
3680
|
+
[epub/index.ts:127](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L127)
|
|
2612
3681
|
|
|
2613
3682
|
### Properties
|
|
2614
3683
|
|
|
3684
|
+
#### locale
|
|
3685
|
+
|
|
3686
|
+
> **locale**: `Locale`
|
|
3687
|
+
|
|
3688
|
+
Defined in:
|
|
3689
|
+
[epub/index.ts:129](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L129)
|
|
3690
|
+
|
|
2615
3691
|
#### name
|
|
2616
3692
|
|
|
2617
3693
|
> **name**: `string`
|
|
2618
3694
|
|
|
2619
3695
|
Defined in:
|
|
2620
|
-
[epub/index.ts:
|
|
3696
|
+
[epub/index.ts:128](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L128)
|
|
3697
|
+
|
|
3698
|
+
---
|
|
3699
|
+
|
|
3700
|
+
## Collection
|
|
3701
|
+
|
|
3702
|
+
Defined in:
|
|
3703
|
+
[epub/index.ts:151](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L151)
|
|
3704
|
+
|
|
3705
|
+
### Properties
|
|
3706
|
+
|
|
3707
|
+
#### name
|
|
3708
|
+
|
|
3709
|
+
> **name**: `string`
|
|
3710
|
+
|
|
3711
|
+
Defined in:
|
|
3712
|
+
[epub/index.ts:152](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L152)
|
|
2621
3713
|
|
|
2622
3714
|
#### position?
|
|
2623
3715
|
|
|
2624
3716
|
> `optional` **position**: `string`
|
|
2625
3717
|
|
|
2626
3718
|
Defined in:
|
|
2627
|
-
[epub/index.ts:
|
|
3719
|
+
[epub/index.ts:154](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L154)
|
|
2628
3720
|
|
|
2629
3721
|
#### type?
|
|
2630
3722
|
|
|
2631
3723
|
> `optional` **type**: `string`
|
|
2632
3724
|
|
|
2633
3725
|
Defined in:
|
|
2634
|
-
[epub/index.ts:
|
|
3726
|
+
[epub/index.ts:153](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L153)
|
|
2635
3727
|
|
|
2636
3728
|
---
|
|
2637
3729
|
|
|
2638
3730
|
## DcCreator
|
|
2639
3731
|
|
|
2640
3732
|
Defined in:
|
|
2641
|
-
[epub/index.ts:
|
|
3733
|
+
[epub/index.ts:132](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L132)
|
|
2642
3734
|
|
|
2643
3735
|
### Properties
|
|
2644
3736
|
|
|
@@ -2647,42 +3739,42 @@ Defined in:
|
|
|
2647
3739
|
> `optional` **alternateScripts**: [`AlternateScript`](#alternatescript)[]
|
|
2648
3740
|
|
|
2649
3741
|
Defined in:
|
|
2650
|
-
[epub/index.ts:
|
|
3742
|
+
[epub/index.ts:137](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L137)
|
|
2651
3743
|
|
|
2652
3744
|
#### fileAs?
|
|
2653
3745
|
|
|
2654
3746
|
> `optional` **fileAs**: `string`
|
|
2655
3747
|
|
|
2656
3748
|
Defined in:
|
|
2657
|
-
[epub/index.ts:
|
|
3749
|
+
[epub/index.ts:136](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L136)
|
|
2658
3750
|
|
|
2659
3751
|
#### name
|
|
2660
3752
|
|
|
2661
3753
|
> **name**: `string`
|
|
2662
3754
|
|
|
2663
3755
|
Defined in:
|
|
2664
|
-
[epub/index.ts:
|
|
3756
|
+
[epub/index.ts:133](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L133)
|
|
2665
3757
|
|
|
2666
3758
|
#### role?
|
|
2667
3759
|
|
|
2668
3760
|
> `optional` **role**: `string`
|
|
2669
3761
|
|
|
2670
3762
|
Defined in:
|
|
2671
|
-
[epub/index.ts:
|
|
3763
|
+
[epub/index.ts:134](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L134)
|
|
2672
3764
|
|
|
2673
3765
|
#### roleScheme?
|
|
2674
3766
|
|
|
2675
3767
|
> `optional` **roleScheme**: `string`
|
|
2676
3768
|
|
|
2677
3769
|
Defined in:
|
|
2678
|
-
[epub/index.ts:
|
|
3770
|
+
[epub/index.ts:135](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L135)
|
|
2679
3771
|
|
|
2680
3772
|
---
|
|
2681
3773
|
|
|
2682
3774
|
## DcSubject
|
|
2683
3775
|
|
|
2684
3776
|
Defined in:
|
|
2685
|
-
[epub/index.ts:
|
|
3777
|
+
[epub/index.ts:121](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L121)
|
|
2686
3778
|
|
|
2687
3779
|
### Properties
|
|
2688
3780
|
|
|
@@ -2691,28 +3783,28 @@ Defined in:
|
|
|
2691
3783
|
> **authority**: `string`
|
|
2692
3784
|
|
|
2693
3785
|
Defined in:
|
|
2694
|
-
[epub/index.ts:
|
|
3786
|
+
[epub/index.ts:123](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L123)
|
|
2695
3787
|
|
|
2696
3788
|
#### term
|
|
2697
3789
|
|
|
2698
3790
|
> **term**: `string`
|
|
2699
3791
|
|
|
2700
3792
|
Defined in:
|
|
2701
|
-
[epub/index.ts:
|
|
3793
|
+
[epub/index.ts:124](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L124)
|
|
2702
3794
|
|
|
2703
3795
|
#### value
|
|
2704
3796
|
|
|
2705
3797
|
> **value**: `string`
|
|
2706
3798
|
|
|
2707
3799
|
Defined in:
|
|
2708
|
-
[epub/index.ts:
|
|
3800
|
+
[epub/index.ts:122](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L122)
|
|
2709
3801
|
|
|
2710
3802
|
---
|
|
2711
3803
|
|
|
2712
3804
|
## DublinCore
|
|
2713
3805
|
|
|
2714
3806
|
Defined in:
|
|
2715
|
-
[epub/index.ts:
|
|
3807
|
+
[epub/index.ts:140](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L140)
|
|
2716
3808
|
|
|
2717
3809
|
### Properties
|
|
2718
3810
|
|
|
@@ -2721,56 +3813,56 @@ Defined in:
|
|
|
2721
3813
|
> `optional` **contributors**: [`DcCreator`](#dccreator)[]
|
|
2722
3814
|
|
|
2723
3815
|
Defined in:
|
|
2724
|
-
[epub/index.ts:
|
|
3816
|
+
[epub/index.ts:147](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L147)
|
|
2725
3817
|
|
|
2726
3818
|
#### creators?
|
|
2727
3819
|
|
|
2728
3820
|
> `optional` **creators**: [`DcCreator`](#dccreator)[]
|
|
2729
3821
|
|
|
2730
3822
|
Defined in:
|
|
2731
|
-
[epub/index.ts:
|
|
3823
|
+
[epub/index.ts:146](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L146)
|
|
2732
3824
|
|
|
2733
3825
|
#### date?
|
|
2734
3826
|
|
|
2735
3827
|
> `optional` **date**: `Date`
|
|
2736
3828
|
|
|
2737
3829
|
Defined in:
|
|
2738
|
-
[epub/index.ts:
|
|
3830
|
+
[epub/index.ts:144](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L144)
|
|
2739
3831
|
|
|
2740
3832
|
#### identifier
|
|
2741
3833
|
|
|
2742
3834
|
> **identifier**: `string`
|
|
2743
3835
|
|
|
2744
3836
|
Defined in:
|
|
2745
|
-
[epub/index.ts:
|
|
3837
|
+
[epub/index.ts:143](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L143)
|
|
2746
3838
|
|
|
2747
3839
|
#### language
|
|
2748
3840
|
|
|
2749
3841
|
> **language**: `Locale`
|
|
2750
3842
|
|
|
2751
3843
|
Defined in:
|
|
2752
|
-
[epub/index.ts:
|
|
3844
|
+
[epub/index.ts:142](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L142)
|
|
2753
3845
|
|
|
2754
3846
|
#### subjects?
|
|
2755
3847
|
|
|
2756
3848
|
> `optional` **subjects**: (`string` \| [`DcSubject`](#dcsubject))[]
|
|
2757
3849
|
|
|
2758
3850
|
Defined in:
|
|
2759
|
-
[epub/index.ts:
|
|
3851
|
+
[epub/index.ts:145](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L145)
|
|
2760
3852
|
|
|
2761
3853
|
#### title
|
|
2762
3854
|
|
|
2763
3855
|
> **title**: `string`
|
|
2764
3856
|
|
|
2765
3857
|
Defined in:
|
|
2766
|
-
[epub/index.ts:
|
|
3858
|
+
[epub/index.ts:141](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L141)
|
|
2767
3859
|
|
|
2768
3860
|
#### type?
|
|
2769
3861
|
|
|
2770
3862
|
> `optional` **type**: `string`
|
|
2771
3863
|
|
|
2772
3864
|
Defined in:
|
|
2773
|
-
[epub/index.ts:
|
|
3865
|
+
[epub/index.ts:148](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L148)
|
|
2774
3866
|
|
|
2775
3867
|
---
|
|
2776
3868
|
|
|
@@ -2802,279 +3894,394 @@ Whether to remove the NCX file, as it's technically optional in EPUB 3.
|
|
|
2802
3894
|
|
|
2803
3895
|
---
|
|
2804
3896
|
|
|
2805
|
-
##
|
|
3897
|
+
## EpubListEntry
|
|
2806
3898
|
|
|
2807
3899
|
Defined in:
|
|
2808
|
-
[epub/
|
|
3900
|
+
[epub/adapters/interface.ts:17](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L17)
|
|
2809
3901
|
|
|
2810
3902
|
### Properties
|
|
2811
3903
|
|
|
2812
|
-
####
|
|
3904
|
+
#### absolutePath
|
|
2813
3905
|
|
|
2814
|
-
> **
|
|
3906
|
+
> **absolutePath**: `string`
|
|
2815
3907
|
|
|
2816
3908
|
Defined in:
|
|
2817
|
-
[epub/
|
|
2818
|
-
|
|
2819
|
-
#### title
|
|
2820
|
-
|
|
2821
|
-
> **title**: `string`
|
|
3909
|
+
[epub/adapters/interface.ts:19](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L19)
|
|
2822
3910
|
|
|
2823
|
-
|
|
2824
|
-
[epub/upgrade.ts:89](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/upgrade.ts#L89)
|
|
3911
|
+
absolute path under [EpubStorageAdapter.rootPath](#rootpath-2)
|
|
2825
3912
|
|
|
2826
|
-
####
|
|
3913
|
+
#### relativePath
|
|
2827
3914
|
|
|
2828
|
-
> **
|
|
3915
|
+
> **relativePath**: `string`
|
|
2829
3916
|
|
|
2830
3917
|
Defined in:
|
|
2831
|
-
[epub/
|
|
3918
|
+
[epub/adapters/interface.ts:21](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L21)
|
|
3919
|
+
|
|
3920
|
+
path relative to [EpubStorageAdapter.rootPath](#rootpath-2), slash-separated
|
|
2832
3921
|
|
|
2833
3922
|
---
|
|
2834
3923
|
|
|
2835
|
-
##
|
|
3924
|
+
## EpubStorageAdapter
|
|
2836
3925
|
|
|
2837
3926
|
Defined in:
|
|
2838
|
-
[epub/
|
|
3927
|
+
[epub/adapters/interface.ts:24](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L24)
|
|
2839
3928
|
|
|
2840
3929
|
### Properties
|
|
2841
3930
|
|
|
2842
|
-
####
|
|
3931
|
+
#### rootPath
|
|
2843
3932
|
|
|
2844
|
-
> **
|
|
3933
|
+
> `readonly` **rootPath**: `string`
|
|
2845
3934
|
|
|
2846
3935
|
Defined in:
|
|
2847
|
-
[epub/
|
|
3936
|
+
[epub/adapters/interface.ts:30](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L30)
|
|
2848
3937
|
|
|
2849
|
-
|
|
3938
|
+
Opaque path prefix used by `resolveInternalHref` to anchor absolute paths within
|
|
3939
|
+
the archive. For TmpFsAdapter this is the tmp dir; for MemoryAdapter it's a
|
|
3940
|
+
virtual prefix that's never written to disk
|
|
2850
3941
|
|
|
2851
|
-
|
|
3942
|
+
### Methods
|
|
3943
|
+
|
|
3944
|
+
#### archiveLength()
|
|
3945
|
+
|
|
3946
|
+
> **archiveLength**(`path`): `Promise`\<`number`\>
|
|
2852
3947
|
|
|
2853
3948
|
Defined in:
|
|
2854
|
-
[epub/
|
|
3949
|
+
[epub/adapters/interface.ts:39](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L39)
|
|
2855
3950
|
|
|
2856
|
-
|
|
3951
|
+
Length of an entry in bytes, for the readium page-count heuristic which expects
|
|
3952
|
+
compressed size when available
|
|
2857
3953
|
|
|
2858
|
-
|
|
3954
|
+
##### Parameters
|
|
2859
3955
|
|
|
2860
|
-
|
|
2861
|
-
|
|
3956
|
+
| Parameter | Type |
|
|
3957
|
+
| --------- | -------- |
|
|
3958
|
+
| `path` | `string` |
|
|
2862
3959
|
|
|
2863
|
-
|
|
3960
|
+
##### Returns
|
|
3961
|
+
|
|
3962
|
+
`Promise`\<`number`\>
|
|
2864
3963
|
|
|
2865
|
-
####
|
|
3964
|
+
#### dispose()
|
|
2866
3965
|
|
|
2867
|
-
> `
|
|
3966
|
+
> **dispose**(): `void` \| `Promise`\<`void`\>
|
|
2868
3967
|
|
|
2869
3968
|
Defined in:
|
|
2870
|
-
[epub/
|
|
3969
|
+
[epub/adapters/interface.ts:58](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L58)
|
|
2871
3970
|
|
|
2872
|
-
|
|
3971
|
+
Always called on close or error
|
|
2873
3972
|
|
|
2874
|
-
|
|
3973
|
+
##### Returns
|
|
2875
3974
|
|
|
2876
|
-
|
|
2877
|
-
[epub/index.ts:142](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L142)
|
|
3975
|
+
`void` \| `Promise`\<`void`\>
|
|
2878
3976
|
|
|
2879
|
-
####
|
|
3977
|
+
#### duplicate()?
|
|
2880
3978
|
|
|
2881
|
-
>
|
|
3979
|
+
> `optional` **duplicate**():
|
|
3980
|
+
> `Promise`\<[`EpubStorageAdapter`](#epubstorageadapter)\>
|
|
2882
3981
|
|
|
2883
3982
|
Defined in:
|
|
2884
|
-
[epub/
|
|
3983
|
+
[epub/adapters/interface.ts:52](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L52)
|
|
2885
3984
|
|
|
2886
|
-
|
|
3985
|
+
Required for Epub.copy
|
|
2887
3986
|
|
|
2888
|
-
|
|
3987
|
+
##### Returns
|
|
3988
|
+
|
|
3989
|
+
`Promise`\<[`EpubStorageAdapter`](#epubstorageadapter)\>
|
|
2889
3990
|
|
|
2890
|
-
|
|
2891
|
-
|
|
3991
|
+
#### list()?
|
|
3992
|
+
|
|
3993
|
+
> `optional` **list**(): `AsyncIterable`\<[`EpubListEntry`](#epublistentry)\>
|
|
2892
3994
|
|
|
2893
3995
|
Defined in:
|
|
2894
|
-
[epub/
|
|
3996
|
+
[epub/adapters/interface.ts:49](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L49)
|
|
2895
3997
|
|
|
2896
|
-
|
|
3998
|
+
Required for Epub.saveAndClose to walk the contents
|
|
2897
3999
|
|
|
2898
|
-
|
|
4000
|
+
##### Returns
|
|
4001
|
+
|
|
4002
|
+
`AsyncIterable`\<[`EpubListEntry`](#epublistentry)\>
|
|
2899
4003
|
|
|
2900
|
-
|
|
4004
|
+
#### read()
|
|
4005
|
+
|
|
4006
|
+
##### Call Signature
|
|
2901
4007
|
|
|
2902
|
-
> **
|
|
4008
|
+
> **read**(`path`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
2903
4009
|
|
|
2904
4010
|
Defined in:
|
|
2905
|
-
[epub/
|
|
4011
|
+
[epub/adapters/interface.ts:32](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L32)
|
|
2906
4012
|
|
|
2907
|
-
|
|
4013
|
+
###### Parameters
|
|
4014
|
+
|
|
4015
|
+
| Parameter | Type |
|
|
4016
|
+
| --------- | -------- |
|
|
4017
|
+
| `path` | `string` |
|
|
4018
|
+
|
|
4019
|
+
###### Returns
|
|
4020
|
+
|
|
4021
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
2908
4022
|
|
|
2909
|
-
|
|
4023
|
+
##### Call Signature
|
|
2910
4024
|
|
|
2911
|
-
> **
|
|
4025
|
+
> **read**(`path`, `encoding`): `Promise`\<`string`\>
|
|
2912
4026
|
|
|
2913
4027
|
Defined in:
|
|
2914
|
-
[epub/
|
|
4028
|
+
[epub/adapters/interface.ts:33](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L33)
|
|
2915
4029
|
|
|
2916
|
-
|
|
4030
|
+
###### Parameters
|
|
2917
4031
|
|
|
2918
|
-
|
|
4032
|
+
| Parameter | Type |
|
|
4033
|
+
| ---------- | --------- |
|
|
4034
|
+
| `path` | `string` |
|
|
4035
|
+
| `encoding` | `"utf-8"` |
|
|
2919
4036
|
|
|
2920
|
-
|
|
4037
|
+
###### Returns
|
|
2921
4038
|
|
|
2922
|
-
|
|
2923
|
-
[epub/index.ts:90](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L90)
|
|
4039
|
+
`Promise`\<`string`\>
|
|
2924
4040
|
|
|
2925
|
-
####
|
|
4041
|
+
#### remove()?
|
|
2926
4042
|
|
|
2927
|
-
> **
|
|
4043
|
+
> `optional` **remove**(`path`): `Promise`\<`void`\>
|
|
2928
4044
|
|
|
2929
4045
|
Defined in:
|
|
2930
|
-
[epub/
|
|
4046
|
+
[epub/adapters/interface.ts:46](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L46)
|
|
2931
4047
|
|
|
2932
|
-
|
|
4048
|
+
Required for removeManifestItem / setCoverImage replacement
|
|
2933
4049
|
|
|
2934
|
-
|
|
4050
|
+
##### Parameters
|
|
2935
4051
|
|
|
2936
|
-
|
|
2937
|
-
|
|
4052
|
+
| Parameter | Type |
|
|
4053
|
+
| --------- | -------- |
|
|
4054
|
+
| `path` | `string` |
|
|
4055
|
+
|
|
4056
|
+
##### Returns
|
|
4057
|
+
|
|
4058
|
+
`Promise`\<`void`\>
|
|
2938
4059
|
|
|
2939
|
-
####
|
|
4060
|
+
#### serialize()?
|
|
2940
4061
|
|
|
2941
|
-
> `optional` **
|
|
4062
|
+
> `optional` **serialize**(`targetPath`): `Promise`\<`void`\>
|
|
2942
4063
|
|
|
2943
4064
|
Defined in:
|
|
2944
|
-
[epub/
|
|
4065
|
+
[epub/adapters/interface.ts:55](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L55)
|
|
4066
|
+
|
|
4067
|
+
Required for Epub.saveAndClose
|
|
4068
|
+
|
|
4069
|
+
##### Parameters
|
|
4070
|
+
|
|
4071
|
+
| Parameter | Type |
|
|
4072
|
+
| ------------ | -------- |
|
|
4073
|
+
| `targetPath` | `string` |
|
|
4074
|
+
|
|
4075
|
+
##### Returns
|
|
4076
|
+
|
|
4077
|
+
`Promise`\<`void`\>
|
|
4078
|
+
|
|
4079
|
+
#### write()?
|
|
2945
4080
|
|
|
2946
|
-
|
|
4081
|
+
##### Call Signature
|
|
2947
4082
|
|
|
2948
|
-
> `optional` **
|
|
4083
|
+
> `optional` **write**(`path`, `data`): `Promise`\<`void`\>
|
|
2949
4084
|
|
|
2950
4085
|
Defined in:
|
|
2951
|
-
[epub/
|
|
4086
|
+
[epub/adapters/interface.ts:42](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L42)
|
|
4087
|
+
|
|
4088
|
+
Required for any mutation method on Epub
|
|
4089
|
+
|
|
4090
|
+
###### Parameters
|
|
4091
|
+
|
|
4092
|
+
| Parameter | Type |
|
|
4093
|
+
| --------- | ------------ |
|
|
4094
|
+
| `path` | `string` |
|
|
4095
|
+
| `data` | `Uint8Array` |
|
|
2952
4096
|
|
|
2953
|
-
|
|
4097
|
+
###### Returns
|
|
4098
|
+
|
|
4099
|
+
`Promise`\<`void`\>
|
|
4100
|
+
|
|
4101
|
+
##### Call Signature
|
|
2954
4102
|
|
|
2955
|
-
> `optional` **
|
|
4103
|
+
> `optional` **write**(`path`, `data`, `encoding`): `Promise`\<`void`\>
|
|
2956
4104
|
|
|
2957
4105
|
Defined in:
|
|
2958
|
-
[epub/
|
|
4106
|
+
[epub/adapters/interface.ts:43](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L43)
|
|
2959
4107
|
|
|
2960
|
-
|
|
4108
|
+
###### Parameters
|
|
4109
|
+
|
|
4110
|
+
| Parameter | Type |
|
|
4111
|
+
| ---------- | --------- |
|
|
4112
|
+
| `path` | `string` |
|
|
4113
|
+
| `data` | `string` |
|
|
4114
|
+
| `encoding` | `"utf-8"` |
|
|
2961
4115
|
|
|
2962
|
-
|
|
4116
|
+
###### Returns
|
|
4117
|
+
|
|
4118
|
+
`Promise`\<`void`\>
|
|
4119
|
+
|
|
4120
|
+
---
|
|
2963
4121
|
|
|
2964
|
-
|
|
4122
|
+
## EpubStorageAdapterClass\<Opts\>
|
|
2965
4123
|
|
|
2966
4124
|
Defined in:
|
|
2967
|
-
[epub/
|
|
4125
|
+
[epub/adapters/interface.ts:61](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L61)
|
|
4126
|
+
|
|
4127
|
+
### Type Parameters
|
|
4128
|
+
|
|
4129
|
+
| Type Parameter | Default type |
|
|
4130
|
+
| ------------------------- | ------------ |
|
|
4131
|
+
| `Opts` _extends_ `object` | `object` |
|
|
2968
4132
|
|
|
2969
4133
|
### Properties
|
|
2970
4134
|
|
|
2971
|
-
####
|
|
4135
|
+
#### capabilities
|
|
2972
4136
|
|
|
2973
|
-
> `
|
|
4137
|
+
> `readonly` **capabilities**:
|
|
4138
|
+
> [`EpubStorageCapabilities`](#epubstoragecapabilities)
|
|
2974
4139
|
|
|
2975
4140
|
Defined in:
|
|
2976
|
-
[epub/
|
|
4141
|
+
[epub/adapters/interface.ts:63](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L63)
|
|
2977
4142
|
|
|
2978
|
-
####
|
|
4143
|
+
#### kind
|
|
2979
4144
|
|
|
2980
|
-
> **
|
|
4145
|
+
> `readonly` **kind**: [`EpubStorageKind`](#epubstoragekind)
|
|
2981
4146
|
|
|
2982
4147
|
Defined in:
|
|
2983
|
-
[epub/
|
|
4148
|
+
[epub/adapters/interface.ts:62](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L62)
|
|
2984
4149
|
|
|
2985
|
-
|
|
4150
|
+
### Methods
|
|
2986
4151
|
|
|
2987
|
-
|
|
4152
|
+
#### init()
|
|
4153
|
+
|
|
4154
|
+
> **init**(`source`, `opts?`):
|
|
4155
|
+
> `Promise`\<[`EpubStorageAdapter`](#epubstorageadapter)\>
|
|
2988
4156
|
|
|
2989
4157
|
Defined in:
|
|
2990
|
-
[epub/
|
|
4158
|
+
[epub/adapters/interface.ts:70](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L70)
|
|
2991
4159
|
|
|
2992
|
-
|
|
4160
|
+
Open an archive from a path or buffer. The returned adapter is ready to read;
|
|
4161
|
+
the Epub class will assert it's a valid EPUB 3 afterwards.
|
|
2993
4162
|
|
|
2994
|
-
|
|
4163
|
+
##### Parameters
|
|
2995
4164
|
|
|
2996
|
-
|
|
2997
|
-
|
|
4165
|
+
| Parameter | Type |
|
|
4166
|
+
| --------- | --------------------------------------------- |
|
|
4167
|
+
| `source` | `string` \| `Uint8Array`\<`ArrayBufferLike`\> |
|
|
4168
|
+
| `opts?` | `Opts` |
|
|
2998
4169
|
|
|
2999
|
-
|
|
4170
|
+
##### Returns
|
|
3000
4171
|
|
|
3001
|
-
|
|
4172
|
+
`Promise`\<[`EpubStorageAdapter`](#epubstorageadapter)\>
|
|
3002
4173
|
|
|
3003
|
-
|
|
4174
|
+
#### initEmpty()?
|
|
4175
|
+
|
|
4176
|
+
> `optional` **initEmpty**(`opts?`):
|
|
4177
|
+
> `Promise`\<[`EpubStorageAdapter`](#epubstorageadapter)\>
|
|
3004
4178
|
|
|
3005
4179
|
Defined in:
|
|
3006
|
-
[epub/
|
|
4180
|
+
[epub/adapters/interface.ts:79](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L79)
|
|
3007
4181
|
|
|
3008
|
-
|
|
4182
|
+
Initialize an empty extract root for [Epub.create](#create).
|
|
3009
4183
|
|
|
3010
|
-
|
|
4184
|
+
Optional — adapters that can't be written to from scratch (e.g. read-only zip
|
|
4185
|
+
handles) should leave this off, and `Epub.using(...).create(...)` will throw.
|
|
3011
4186
|
|
|
3012
|
-
|
|
4187
|
+
##### Parameters
|
|
3013
4188
|
|
|
3014
|
-
|
|
3015
|
-
|
|
4189
|
+
| Parameter | Type |
|
|
4190
|
+
| --------- | ------ |
|
|
4191
|
+
| `opts?` | `Opts` |
|
|
4192
|
+
|
|
4193
|
+
##### Returns
|
|
4194
|
+
|
|
4195
|
+
`Promise`\<[`EpubStorageAdapter`](#epubstorageadapter)\>
|
|
3016
4196
|
|
|
3017
4197
|
---
|
|
3018
4198
|
|
|
3019
|
-
##
|
|
4199
|
+
## EpubStorageCapabilities
|
|
4200
|
+
|
|
4201
|
+
Defined in:
|
|
4202
|
+
[epub/adapters/interface.ts:12](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L12)
|
|
4203
|
+
|
|
4204
|
+
### Properties
|
|
4205
|
+
|
|
4206
|
+
#### writable
|
|
3020
4207
|
|
|
3021
|
-
> **
|
|
4208
|
+
> `readonly` **writable**: `boolean`
|
|
3022
4209
|
|
|
3023
4210
|
Defined in:
|
|
3024
|
-
[epub/
|
|
4211
|
+
[epub/adapters/interface.ts:14](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/interface.ts#L14)
|
|
3025
4212
|
|
|
3026
|
-
|
|
4213
|
+
when false, the Epub class refuses every mutation method at runtime
|
|
3027
4214
|
|
|
3028
4215
|
---
|
|
3029
4216
|
|
|
3030
|
-
##
|
|
3031
|
-
|
|
3032
|
-
> **XmlElement**\<`Name`\> = `object` & `{ [key in Name]: ParsedXml }`
|
|
4217
|
+
## FromOptions
|
|
3033
4218
|
|
|
3034
4219
|
Defined in:
|
|
3035
|
-
[epub/index.ts:
|
|
4220
|
+
[epub/index.ts:178](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L178)
|
|
4221
|
+
|
|
4222
|
+
### Properties
|
|
3036
4223
|
|
|
3037
|
-
|
|
4224
|
+
#### readonly?
|
|
3038
4225
|
|
|
3039
|
-
|
|
4226
|
+
> `optional` **readonly**: `boolean`
|
|
3040
4227
|
|
|
3041
|
-
|
|
4228
|
+
Defined in:
|
|
4229
|
+
[epub/index.ts:183](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L183)
|
|
3042
4230
|
|
|
3043
|
-
|
|
4231
|
+
when true, mutation methods throw [EpubReadOnlyError](#epubreadonlyerror) at
|
|
4232
|
+
runtime
|
|
3044
4233
|
|
|
3045
|
-
|
|
4234
|
+
##### Default
|
|
3046
4235
|
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
4236
|
+
```ts
|
|
4237
|
+
false
|
|
4238
|
+
```
|
|
3050
4239
|
|
|
3051
4240
|
---
|
|
3052
4241
|
|
|
3053
|
-
##
|
|
4242
|
+
## Landmark
|
|
4243
|
+
|
|
4244
|
+
Defined in:
|
|
4245
|
+
[epub/upgrade.ts:87](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/upgrade.ts#L87)
|
|
4246
|
+
|
|
4247
|
+
### Properties
|
|
4248
|
+
|
|
4249
|
+
#### href
|
|
3054
4250
|
|
|
3055
|
-
> **
|
|
4251
|
+
> **href**: `string`
|
|
3056
4252
|
|
|
3057
4253
|
Defined in:
|
|
3058
|
-
[epub/
|
|
4254
|
+
[epub/upgrade.ts:88](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/upgrade.ts#L88)
|
|
3059
4255
|
|
|
3060
|
-
|
|
4256
|
+
#### title
|
|
3061
4257
|
|
|
3062
|
-
|
|
4258
|
+
> **title**: `string`
|
|
4259
|
+
|
|
4260
|
+
Defined in:
|
|
4261
|
+
[epub/upgrade.ts:89](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/upgrade.ts#L89)
|
|
3063
4262
|
|
|
3064
|
-
|
|
4263
|
+
#### type
|
|
3065
4264
|
|
|
3066
|
-
> **
|
|
4265
|
+
> **type**: `string`
|
|
3067
4266
|
|
|
3068
4267
|
Defined in:
|
|
3069
|
-
[epub/
|
|
4268
|
+
[epub/upgrade.ts:90](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/upgrade.ts#L90)
|
|
4269
|
+
|
|
4270
|
+
---
|
|
4271
|
+
|
|
4272
|
+
## MemoryAdapterOptions
|
|
3070
4273
|
|
|
3071
|
-
|
|
4274
|
+
Defined in:
|
|
4275
|
+
[epub/adapters/memory.ts:15](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L15)
|
|
3072
4276
|
|
|
3073
4277
|
### Properties
|
|
3074
4278
|
|
|
3075
|
-
####
|
|
4279
|
+
#### cache?
|
|
3076
4280
|
|
|
3077
|
-
>
|
|
4281
|
+
> `optional` **cache**: `boolean`
|
|
3078
4282
|
|
|
3079
4283
|
Defined in:
|
|
3080
|
-
[epub/
|
|
4284
|
+
[epub/adapters/memory.ts:22](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/adapters/memory.ts#L22)
|
|
4285
|
+
|
|
4286
|
+
per-entry decompressed buffer cache turn it off when opening many EPUBs and
|
|
4287
|
+
reading eac
|