@storyteller-platform/epub 0.4.8 → 0.4.9

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 CHANGED
@@ -326,7 +326,7 @@ Defined in:
326
326
  > **\[dispose\]**(): `void`
327
327
 
328
328
  Defined in:
329
- [epub/index.ts:2541](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2541)
329
+ [epub/index.ts:2557](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2557)
330
330
 
331
331
  ##### Returns
332
332
 
@@ -337,7 +337,7 @@ Defined in:
337
337
  > **addCollection**(`collection`, `index?`): `Promise`\<`void`\>
338
338
 
339
339
  Defined in:
340
- [epub/index.ts:1532](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1532)
340
+ [epub/index.ts:1548](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1548)
341
341
 
342
342
  Add a collection to the EPUB metadata.
343
343
 
@@ -360,7 +360,7 @@ collections. Otherwise, it will be added to the end of the list.
360
360
  > **addContributor**(`contributor`, `index?`): `Promise`\<`void`\>
361
361
 
362
362
  Defined in:
363
- [epub/index.ts:1874](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1874)
363
+ [epub/index.ts:1890](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1890)
364
364
 
365
365
  Add a contributor to the EPUB metadata.
366
366
 
@@ -390,7 +390,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
390
390
  > **addCreator**(`creator`, `index?`, `type?`): `Promise`\<`void`\>
391
391
 
392
392
  Defined in:
393
- [epub/index.ts:1719](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1719)
393
+ [epub/index.ts:1735](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1735)
394
394
 
395
395
  Add a creator to the EPUB metadata.
396
396
 
@@ -420,7 +420,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
420
420
  > **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
421
421
 
422
422
  Defined in:
423
- [epub/index.ts:2237](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2237)
423
+ [epub/index.ts:2253](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2253)
424
424
 
425
425
  Create a new manifest item and write its contents to a new entry.
426
426
 
@@ -449,7 +449,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
449
449
  > **addManifestItem**(`item`, `contents`, `encoding`): `Promise`\<`void`\>
450
450
 
451
451
  Defined in:
452
- [epub/index.ts:2242](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2242)
452
+ [epub/index.ts:2258](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2258)
453
453
 
454
454
  Create a new manifest item and write its contents to a new entry.
455
455
 
@@ -478,7 +478,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
478
478
  > **addManifestItem**(`item`, `contents`): `Promise`\<`void`\>
479
479
 
480
480
  Defined in:
481
- [epub/index.ts:2247](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2247)
481
+ [epub/index.ts:2263](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2263)
482
482
 
483
483
  Create a new manifest item and write its contents to a new entry.
484
484
 
@@ -506,7 +506,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
506
506
  > **addMetadata**(`entry`): `Promise`\<`void`\>
507
507
 
508
508
  Defined in:
509
- [epub/index.ts:2359](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2359)
509
+ [epub/index.ts:2375](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2375)
510
510
 
511
511
  Add a new metadata entry to the Epub.
512
512
 
@@ -533,7 +533,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
533
533
  > **addSpineItem**(`manifestId`, `index?`): `Promise`\<`void`\>
534
534
 
535
535
  Defined in:
536
- [epub/index.ts:1928](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1928)
536
+ [epub/index.ts:1944](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1944)
537
537
 
538
538
  Add an item to the spine of the EPUB.
539
539
 
@@ -563,7 +563,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
563
563
  > **addSubject**(`subject`): `Promise`\<`void`\>
564
564
 
565
565
  Defined in:
566
- [epub/index.ts:1061](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1061)
566
+ [epub/index.ts:1077](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1077)
567
567
 
568
568
  Add a subject to the EPUB metadata.
569
569
 
@@ -581,6 +581,23 @@ Add a subject to the EPUB metadata.
581
581
 
582
582
  https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
583
583
 
584
+ #### copy()
585
+
586
+ > **copy**(`path?`): `Promise`\<[`Epub`](#epub)\>
587
+
588
+ Defined in:
589
+ [epub/index.ts:535](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L535)
590
+
591
+ ##### Parameters
592
+
593
+ | Parameter | Type |
594
+ | --------- | -------- |
595
+ | `path?` | `string` |
596
+
597
+ ##### Returns
598
+
599
+ `Promise`\<[`Epub`](#epub)\>
600
+
584
601
  #### createXhtmlDocument()
585
602
 
586
603
  > **createXhtmlDocument**(`body`, `head?`, `language?`):
@@ -588,7 +605,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
588
605
  > [`XmlElement`](#xmlelement)\<`"?xml"`\>)[]\>
589
606
 
590
607
  Defined in:
591
- [epub/index.ts:2063](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2063)
608
+ [epub/index.ts:2079](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2079)
592
609
 
593
610
  Create a new XHTML document with the given body and head.
594
611
 
@@ -610,7 +627,7 @@ Create a new XHTML document with the given body and head.
610
627
  > **discardAndClose**(): `void`
611
628
 
612
629
  Defined in:
613
- [epub/index.ts:2468](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2468)
630
+ [epub/index.ts:2484](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2484)
614
631
 
615
632
  ##### Returns
616
633
 
@@ -621,7 +638,7 @@ Defined in:
621
638
  > **findAllMetadataItems**(`predicate`): `Promise`\<`object`[]\>
622
639
 
623
640
  Defined in:
624
- [epub/index.ts:784](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L784)
641
+ [epub/index.ts:800](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L800)
625
642
 
626
643
  Returns the item in the metadata element's children array that matches the
627
644
  provided predicate.
@@ -661,7 +678,7 @@ provided predicate.
661
678
  > \}\>
662
679
 
663
680
  Defined in:
664
- [epub/index.ts:775](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L775)
681
+ [epub/index.ts:791](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L791)
665
682
 
666
683
  Returns the item in the metadata element's children array that matches the
667
684
  provided predicate.
@@ -700,7 +717,7 @@ provided predicate.
700
717
  > **getCollections**(): `Promise`\<[`Collection`](#collection)[]\>
701
718
 
702
719
  Defined in:
703
- [epub/index.ts:1492](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1492)
720
+ [epub/index.ts:1508](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1508)
704
721
 
705
722
  Retrieve the list of collections.
706
723
 
@@ -713,7 +730,7 @@ Retrieve the list of collections.
713
730
  > **getContributors**(): `Promise`\<[`DcCreator`](#dccreator)[]\>
714
731
 
715
732
  Defined in:
716
- [epub/index.ts:1706](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1706)
733
+ [epub/index.ts:1722](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1722)
717
734
 
718
735
  Retrieve the list of contributors.
719
736
 
@@ -732,7 +749,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccontributor
732
749
  > **getCoverImage**(): `Promise`\<`null` \| `Uint8Array`\<`ArrayBufferLike`\>\>
733
750
 
734
751
  Defined in:
735
- [epub/index.ts:964](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L964)
752
+ [epub/index.ts:980](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L980)
736
753
 
737
754
  Retrieve the cover image data as a byte array.
738
755
 
@@ -753,7 +770,7 @@ https://www.w3.org/TR/epub-33/#sec-cover-image
753
770
  > [`ManifestItem`](#manifestitem)\>
754
771
 
755
772
  Defined in:
756
- [epub/index.ts:945](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L945)
773
+ [epub/index.ts:961](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L961)
757
774
 
758
775
  Retrieve the cover image manifest item.
759
776
 
@@ -773,7 +790,7 @@ https://www.w3.org/TR/epub-33/#sec-cover-image
773
790
  > **getCreators**(`type`): `Promise`\<[`DcCreator`](#dccreator)[]\>
774
791
 
775
792
  Defined in:
776
- [epub/index.ts:1645](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1645)
793
+ [epub/index.ts:1661](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1661)
777
794
 
778
795
  Retrieve the list of creators.
779
796
 
@@ -796,7 +813,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
796
813
  > **getDescription**(): `Promise`\<`null` \| `string`\>
797
814
 
798
815
  Defined in:
799
- [epub/index.ts:1343](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1343)
816
+ [epub/index.ts:1359](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1359)
800
817
 
801
818
  Retrieve the Epub's description as specified in its package document metadata.
802
819
 
@@ -812,7 +829,7 @@ as a string. Descriptions may include HTML markup.
812
829
  > **getIdentifier**(): `Promise`\<`null` \| `string`\>
813
830
 
814
831
  Defined in:
815
- [epub/index.ts:879](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L879)
832
+ [epub/index.ts:895](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L895)
816
833
 
817
834
  Retrieve the identifier from the dc:identifier element in the EPUB metadata.
818
835
 
@@ -831,7 +848,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcidentifier
831
848
  > **getLanguage**(): `Promise`\<`null` \| `Locale`\>
832
849
 
833
850
  Defined in:
834
- [epub/index.ts:1180](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1180)
851
+ [epub/index.ts:1196](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1196)
835
852
 
836
853
  Retrieve the Epub's language as specified in its package document metadata.
837
854
 
@@ -852,7 +869,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
852
869
  > [`ManifestItem`](#manifestitem)\>\>
853
870
 
854
871
  Defined in:
855
- [epub/index.ts:700](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L700)
872
+ [epub/index.ts:716](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L716)
856
873
 
857
874
  Retrieve the manifest for the Epub.
858
875
 
@@ -872,7 +889,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-manifest
872
889
  > **getMetadata**(): `Promise`\<[`EpubMetadata`](#epubmetadata)\>
873
890
 
874
891
  Defined in:
875
- [epub/index.ts:851](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L851)
892
+ [epub/index.ts:867](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L867)
876
893
 
877
894
  Retrieve the metadata entries for the Epub.
878
895
 
@@ -896,7 +913,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
896
913
  > `string`\>\>
897
914
 
898
915
  Defined in:
899
- [epub/index.ts:1360](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1360)
916
+ [epub/index.ts:1376](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1376)
900
917
 
901
918
  Return the set of custom vocabulary prefixes set on this publication's root
902
919
  package element.
@@ -916,7 +933,7 @@ https://www.w3.org/TR/epub-33/#sec-prefix-attr
916
933
  > **getPublicationDate**(): `Promise`\<`null` \| `Date`\>
917
934
 
918
935
  Defined in:
919
- [epub/index.ts:1001](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1001)
936
+ [epub/index.ts:1017](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1017)
920
937
 
921
938
  Retrieve the publication date from the dc:date element in the EPUB metadata as a
922
939
  Date object.
@@ -936,7 +953,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcdate
936
953
  > **getRootfile**(): `Promise`\<`string`\>
937
954
 
938
955
  Defined in:
939
- [epub/index.ts:552](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L552)
956
+ [epub/index.ts:568](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L568)
940
957
 
941
958
  ##### Returns
942
959
 
@@ -947,7 +964,7 @@ Defined in:
947
964
  > **getSpineItems**(): `Promise`\<[`ManifestItem`](#manifestitem)[]\>
948
965
 
949
966
  Defined in:
950
- [epub/index.ts:1909](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1909)
967
+ [epub/index.ts:1925](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1925)
951
968
 
952
969
  Retrieve the manifest items that make up the Epub's spine.
953
970
 
@@ -967,7 +984,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
967
984
  > **getSubjects**(): `Promise`\<(`string` \| [`DcSubject`](#dcsubject))[]\>
968
985
 
969
986
  Defined in:
970
- [epub/index.ts:1135](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1135)
987
+ [epub/index.ts:1151](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1151)
971
988
 
972
989
  Retrieve the list of subjects for this EPUB.
973
990
 
@@ -988,7 +1005,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcsubject
988
1005
  > **getSubtitle**(): `Promise`\<`null` \| `string`\>
989
1006
 
990
1007
  Defined in:
991
- [epub/index.ts:1250](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1250)
1008
+ [epub/index.ts:1266](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1266)
992
1009
 
993
1010
  Retrieve the subtitle of the Epub, if it exists.
994
1011
 
@@ -1005,7 +1022,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1005
1022
  > **getTitle**(`expanded`): `Promise`\<`null` \| `string`\>
1006
1023
 
1007
1024
  Defined in:
1008
- [epub/index.ts:1226](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1226)
1025
+ [epub/index.ts:1242](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1242)
1009
1026
 
1010
1027
  Retrieve the title of the Epub.
1011
1028
 
@@ -1028,7 +1045,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1028
1045
  > **getTitles**(): `Promise`\<`object`[]\>
1029
1046
 
1030
1047
  Defined in:
1031
- [epub/index.ts:1262](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1262)
1048
+ [epub/index.ts:1278](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1278)
1032
1049
 
1033
1050
  Retrieve all title entries of the Epub.
1034
1051
 
@@ -1045,7 +1062,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1045
1062
  > **getType**(): `Promise`\<`null` \| [`MetadataEntry`](#metadataentry)\>
1046
1063
 
1047
1064
  Defined in:
1048
- [epub/index.ts:1048](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1048)
1065
+ [epub/index.ts:1064](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1064)
1049
1066
 
1050
1067
  Retrieve the publication type from the dc:type element in the EPUB metadata.
1051
1068
 
@@ -1067,7 +1084,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctype
1067
1084
  > `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
1068
1085
 
1069
1086
  Defined in:
1070
- [epub/index.ts:2004](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2004)
1087
+ [epub/index.ts:2020](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2020)
1071
1088
 
1072
1089
  Retrieve the contents of a file, given its href.
1073
1090
 
@@ -1090,7 +1107,7 @@ encoding parameter.
1090
1107
  > **readFileContents**(`href`, `relativeTo`, `encoding`): `Promise`\<`string`\>
1091
1108
 
1092
1109
  Defined in:
1093
- [epub/index.ts:2005](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2005)
1110
+ [epub/index.ts:2021](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2021)
1094
1111
 
1095
1112
  Retrieve the contents of a file, given its href.
1096
1113
 
@@ -1116,7 +1133,7 @@ encoding parameter.
1116
1133
  > **readItemContents**(`id`): `Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
1117
1134
 
1118
1135
  Defined in:
1119
- [epub/index.ts:2035](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2035)
1136
+ [epub/index.ts:2051](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2051)
1120
1137
 
1121
1138
  Retrieve the contents of a manifest item, given its id.
1122
1139
 
@@ -1139,7 +1156,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1139
1156
  > **readItemContents**(`id`, `encoding`): `Promise`\<`string`\>
1140
1157
 
1141
1158
  Defined in:
1142
- [epub/index.ts:2036](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2036)
1159
+ [epub/index.ts:2052](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2052)
1143
1160
 
1144
1161
  Retrieve the contents of a manifest item, given its id.
1145
1162
 
@@ -1165,7 +1182,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1165
1182
  > **readXhtmlItemContents**(`id`, `as?`): `Promise`\<[`ParsedXml`](#parsedxml)\>
1166
1183
 
1167
1184
  Defined in:
1168
- [epub/index.ts:2098](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2098)
1185
+ [epub/index.ts:2114](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2114)
1169
1186
 
1170
1187
  Retrieves the contents of an XHTML item, given its manifest id.
1171
1188
 
@@ -1189,7 +1206,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
1189
1206
  > **readXhtmlItemContents**(`id`, `as`): `Promise`\<`string`\>
1190
1207
 
1191
1208
  Defined in:
1192
- [epub/index.ts:2099](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2099)
1209
+ [epub/index.ts:2115](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2115)
1193
1210
 
1194
1211
  Retrieves the contents of an XHTML item, given its manifest id.
1195
1212
 
@@ -1213,7 +1230,7 @@ https://www.w3.org/TR/epub-33/#sec-xhtml
1213
1230
  > **removeCollection**(`index`): `Promise`\<`void`\>
1214
1231
 
1215
1232
  Defined in:
1216
- [epub/index.ts:1601](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1601)
1233
+ [epub/index.ts:1617](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1617)
1217
1234
 
1218
1235
  Remove a collection from the EPUB metadata.
1219
1236
 
@@ -1235,7 +1252,7 @@ returned by `epub.getCollections()`.
1235
1252
  > **removeContributor**(`index`): `Promise`\<`void`\>
1236
1253
 
1237
1254
  Defined in:
1238
- [epub/index.ts:1858](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1858)
1255
+ [epub/index.ts:1874](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1874)
1239
1256
 
1240
1257
  Remove a contributor from the EPUB metadata.
1241
1258
 
@@ -1263,7 +1280,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
1263
1280
  > **removeCreator**(`index`, `type`): `Promise`\<`void`\>
1264
1281
 
1265
1282
  Defined in:
1266
- [epub/index.ts:1806](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1806)
1283
+ [epub/index.ts:1822](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1822)
1267
1284
 
1268
1285
  Remove a creator from the EPUB metadata.
1269
1286
 
@@ -1290,7 +1307,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
1290
1307
  > **removeManifestItem**(`id`): `Promise`\<`void`\>
1291
1308
 
1292
1309
  Defined in:
1293
- [epub/index.ts:2194](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2194)
1310
+ [epub/index.ts:2210](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2210)
1294
1311
 
1295
1312
  ##### Parameters
1296
1313
 
@@ -1307,7 +1324,7 @@ Defined in:
1307
1324
  > **removeMetadata**(`predicate`): `Promise`\<`void`\>
1308
1325
 
1309
1326
  Defined in:
1310
- [epub/index.ts:2443](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2443)
1327
+ [epub/index.ts:2459](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2459)
1311
1328
 
1312
1329
  Remove one or more metadata entries.
1313
1330
 
@@ -1333,7 +1350,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
1333
1350
  > **removeSpineItem**(`index`): `Promise`\<`void`\>
1334
1351
 
1335
1352
  Defined in:
1336
- [epub/index.ts:1964](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1964)
1353
+ [epub/index.ts:1980](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1980)
1337
1354
 
1338
1355
  Remove the spine item at the specified index.
1339
1356
 
@@ -1356,7 +1373,7 @@ https://www.w3.org/TR/epub-33/#sec-spine-elem
1356
1373
  > **removeSubject**(`index`): `Promise`\<`void`\>
1357
1374
 
1358
1375
  Defined in:
1359
- [epub/index.ts:1098](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1098)
1376
+ [epub/index.ts:1114](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1114)
1360
1377
 
1361
1378
  Remove a subject from the EPUB metadata.
1362
1379
 
@@ -1382,7 +1399,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dccreator
1382
1399
  > **replaceMetadata**(`predicate`, `entry`): `Promise`\<`void`\>
1383
1400
 
1384
1401
  Defined in:
1385
- [epub/index.ts:2398](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2398)
1402
+ [epub/index.ts:2414](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2414)
1386
1403
 
1387
1404
  Replace a metadata entry with a new one.
1388
1405
 
@@ -1409,7 +1426,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-metadata
1409
1426
  > **saveAndClose**(): `Promise`\<`void`\>
1410
1427
 
1411
1428
  Defined in:
1412
- [epub/index.ts:2484](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2484)
1429
+ [epub/index.ts:2500](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2500)
1413
1430
 
1414
1431
  Write the current contents of the Epub to a new EPUB archive on disk.
1415
1432
 
@@ -1425,7 +1442,7 @@ updated to the current UTC timestamp.
1425
1442
  > **setCoverImage**(`href`, `data`): `Promise`\<`void`\>
1426
1443
 
1427
1444
  Defined in:
1428
- [epub/index.ts:978](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L978)
1445
+ [epub/index.ts:994](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L994)
1429
1446
 
1430
1447
  Set the cover image for the EPUB.
1431
1448
 
@@ -1448,7 +1465,7 @@ then writes the provided image data to the provided href within the publication.
1448
1465
  > **setDescription**(`description`): `Promise`\<`void`\>
1449
1466
 
1450
1467
  Defined in:
1451
- [epub/index.ts:1327](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1327)
1468
+ [epub/index.ts:1343](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1343)
1452
1469
 
1453
1470
  Update the Epub's description metadata entry.
1454
1471
 
@@ -1471,7 +1488,7 @@ encoded as HTML entities.
1471
1488
  > **setIdentifier**(`identifier`): `Promise`\<`void`\>
1472
1489
 
1473
1490
  Defined in:
1474
- [epub/index.ts:893](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L893)
1491
+ [epub/index.ts:909](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L909)
1475
1492
 
1476
1493
  Set the dc:identifier metadata element with the provided string.
1477
1494
 
@@ -1497,7 +1514,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcidentifier
1497
1514
  > **setLanguage**(`locale`): `Promise`\<`void`\>
1498
1515
 
1499
1516
  Defined in:
1500
- [epub/index.ts:1209](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1209)
1517
+ [epub/index.ts:1225](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1225)
1501
1518
 
1502
1519
  Update the Epub's language metadata entry.
1503
1520
 
@@ -1523,7 +1540,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dclanguage
1523
1540
  > **setPackageVocabularyPrefix**(`prefix`, `uri`): `Promise`\<`void`\>
1524
1541
 
1525
1542
  Defined in:
1526
- [epub/index.ts:1378](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1378)
1543
+ [epub/index.ts:1394](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1394)
1527
1544
 
1528
1545
  Set a custom vocabulary prefix on the root package element.
1529
1546
 
@@ -1547,7 +1564,7 @@ https://www.w3.org/TR/epub-33/#sec-prefix-attr
1547
1564
  > **setPublicationDate**(`date`): `Promise`\<`void`\>
1548
1565
 
1549
1566
  Defined in:
1550
- [epub/index.ts:1016](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1016)
1567
+ [epub/index.ts:1032](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1032)
1551
1568
 
1552
1569
  Set the dc:date metadata element with the provided date.
1553
1570
 
@@ -1573,7 +1590,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dcdate
1573
1590
  > **setTitle**(`title`): `Promise`\<`void`\>
1574
1591
 
1575
1592
  Defined in:
1576
- [epub/index.ts:1402](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1402)
1593
+ [epub/index.ts:1418](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1418)
1577
1594
 
1578
1595
  Set the title of the Epub.
1579
1596
 
@@ -1601,7 +1618,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctitle
1601
1618
  > **setTitles**(`entries`): `Promise`\<`void`\>
1602
1619
 
1603
1620
  Defined in:
1604
- [epub/index.ts:1430](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1430)
1621
+ [epub/index.ts:1446](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1446)
1605
1622
 
1606
1623
  ##### Parameters
1607
1624
 
@@ -1618,7 +1635,7 @@ Defined in:
1618
1635
  > **setType**(`type`): `Promise`\<`void`\>
1619
1636
 
1620
1637
  Defined in:
1621
- [epub/index.ts:1032](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1032)
1638
+ [epub/index.ts:1048](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L1048)
1622
1639
 
1623
1640
  Set the dc:type metadata element.
1624
1641
 
@@ -1644,7 +1661,7 @@ https://www.w3.org/TR/epub-33/#sec-opf-dctype
1644
1661
  > **updateManifestItem**(`id`, `newItem`): `Promise`\<`void`\>
1645
1662
 
1646
1663
  Defined in:
1647
- [epub/index.ts:2310](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2310)
1664
+ [epub/index.ts:2326](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2326)
1648
1665
 
1649
1666
  Update the manifest entry for an existing item.
1650
1667
 
@@ -1673,7 +1690,7 @@ https://www.w3.org/TR/epub-33/#sec-pkg-manifest
1673
1690
  > **writeItemContents**(`id`, `contents`): `Promise`\<`void`\>
1674
1691
 
1675
1692
  Defined in:
1676
- [epub/index.ts:2146](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2146)
1693
+ [epub/index.ts:2162](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2162)
1677
1694
 
1678
1695
  Write new contents for an existing manifest item, specified by its id.
1679
1696
 
@@ -1700,7 +1717,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1700
1717
  > **writeItemContents**(`id`, `contents`, `encoding`): `Promise`\<`void`\>
1701
1718
 
1702
1719
  Defined in:
1703
- [epub/index.ts:2147](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2147)
1720
+ [epub/index.ts:2163](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2163)
1704
1721
 
1705
1722
  Write new contents for an existing manifest item, specified by its id.
1706
1723
 
@@ -1728,7 +1745,7 @@ https://www.w3.org/TR/epub-33/#sec-contentdocs
1728
1745
  > **writeXhtmlItemContents**(`id`, `contents`): `Promise`\<`void`\>
1729
1746
 
1730
1747
  Defined in:
1731
- [epub/index.ts:2186](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2186)
1748
+ [epub/index.ts:2202](https://gitlab.com/storyteller-platform/storyteller/-/blob/main/epub/index.ts#L2202)
1732
1749
 
1733
1750
  Write new contents for an existing XHTML item, specified by its id.
1734
1751
 
package/dist/index.cjs CHANGED
@@ -385,6 +385,19 @@ ${JSON.stringify(element, null, 2)}`
385
385
  typeof pathOrData === "string" ? pathOrData : void 0
386
386
  );
387
387
  }
388
+ async copy(path) {
389
+ const extractPath = (0, import_path.join)(
390
+ (0, import_node_os.tmpdir)(),
391
+ `storyteller-platform-epub-${(0, import_node_crypto.randomUUID)()}.epub`
392
+ );
393
+ try {
394
+ await (0, import_promises.cp)(this.extractPath, extractPath, { recursive: true });
395
+ } catch (error) {
396
+ (0, import_node_fs.rmSync)(extractPath, { force: true, recursive: true });
397
+ throw error;
398
+ }
399
+ return new Epub(extractPath, path);
400
+ }
388
401
  async removeEntry(href) {
389
402
  const rootfile = await this.getRootfile();
390
403
  const filename = this.resolveHref(rootfile, href);
package/dist/index.d.cts CHANGED
@@ -186,6 +186,7 @@ declare class Epub {
186
186
  * the data of the EPUB publication.
187
187
  */
188
188
  static from(pathOrData: string | Uint8Array): Promise<Epub>;
189
+ copy(path?: string): Promise<Epub>;
189
190
  private removeEntry;
190
191
  private getFileData;
191
192
  getRootfile(): Promise<string>;
package/dist/index.d.ts CHANGED
@@ -186,6 +186,7 @@ declare class Epub {
186
186
  * the data of the EPUB publication.
187
187
  */
188
188
  static from(pathOrData: string | Uint8Array): Promise<Epub>;
189
+ copy(path?: string): Promise<Epub>;
189
190
  private removeEntry;
190
191
  private getFileData;
191
192
  getRootfile(): Promise<string>;
package/dist/index.js CHANGED
@@ -352,6 +352,19 @@ ${JSON.stringify(element, null, 2)}`
352
352
  typeof pathOrData === "string" ? pathOrData : void 0
353
353
  );
354
354
  }
355
+ async copy(path) {
356
+ const extractPath = join(
357
+ tmpdir(),
358
+ `storyteller-platform-epub-${randomUUID()}.epub`
359
+ );
360
+ try {
361
+ await cp(this.extractPath, extractPath, { recursive: true });
362
+ } catch (error) {
363
+ rmSync(extractPath, { force: true, recursive: true });
364
+ throw error;
365
+ }
366
+ return new Epub(extractPath, path);
367
+ }
355
368
  async removeEntry(href) {
356
369
  const rootfile = await this.getRootfile();
357
370
  const filename = this.resolveHref(rootfile, href);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyteller-platform/epub",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",