single-file-core 1.5.100 → 1.5.101
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/package.json
CHANGED
|
@@ -27,7 +27,7 @@ export {
|
|
|
27
27
|
extract
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
async function extract(content, { password, prompt = () => { }, zipOptions = { useWebWorkers: true }, noBlobURL, entries, pagePath = "", excludedPaths } = {}) {
|
|
30
|
+
async function extract(content, { password, prompt = () => { }, zipOptions = { useWebWorkers: true }, noBlobURL, entries, pagePath = "", excludedPaths, aliases } = {}) {
|
|
31
31
|
const KNOWN_MIMETYPES = {
|
|
32
32
|
"gif": "image/gif",
|
|
33
33
|
"jpg": "image/jpeg",
|
|
@@ -89,6 +89,20 @@ async function extract(content, { password, prompt = () => { }, zipOptions = { u
|
|
|
89
89
|
zipReader = new zip.ZipReader(reader);
|
|
90
90
|
entries = await zipReader.getEntries();
|
|
91
91
|
}
|
|
92
|
+
if (aliases) {
|
|
93
|
+
const allEntries = entries;
|
|
94
|
+
entries = entries.map(entry => {
|
|
95
|
+
const canonicalFilename = aliases[entry.filename];
|
|
96
|
+
const canonicalEntry = canonicalFilename && allEntries.find(otherEntry => otherEntry.filename == canonicalFilename);
|
|
97
|
+
return canonicalEntry ? {
|
|
98
|
+
filename: entry.filename,
|
|
99
|
+
comment: canonicalEntry.comment,
|
|
100
|
+
encrypted: canonicalEntry.encrypted,
|
|
101
|
+
uncompressedSize: canonicalEntry.uncompressedSize,
|
|
102
|
+
getData: (writer, options) => canonicalEntry.getData(writer, options)
|
|
103
|
+
} : entry;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
92
106
|
if (pagePath) {
|
|
93
107
|
entries = entries.filter(entry => entry.filename.startsWith(pagePath));
|
|
94
108
|
} else if (excludedPaths) {
|