single-file-core 1.5.29 → 1.5.30

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.5.29",
3
+ "version": "1.5.30",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",
@@ -111,6 +111,10 @@ async function process(pageData, options, lastModDate = new Date()) {
111
111
  const hmtlData = new Uint8Array([...getLength(htmlArray.length + 4), ...[0x74, 0x45, 0x58, 0x74, 0x50, 0x4e, 0x47, 0], ...htmlArray]);
112
112
  await writeData(zipDataWriter.writable, hmtlData);
113
113
  await writeData(zipDataWriter.writable, getCRC32(hmtlData, 4));
114
+ } else if (options.embeddedPdf) {
115
+ const data = new Uint8Array([...getLength(options.embeddedPdf.length + 4), ...[0x74, 0x45, 0x58, 0x74, 0x50, 0x44, 0x46, 0], ...new Uint8Array(options.embeddedPdf)]);
116
+ await writeData(zipDataWriter.writable, data);
117
+ await writeData(zipDataWriter.writable, getCRC32(data, 4));
114
118
  }
115
119
  await writeData(zipDataWriter.writable, embeddedImageData);
116
120
  await writeData(zipDataWriter.writable, new Uint8Array(4));
@@ -122,6 +126,8 @@ async function process(pageData, options, lastModDate = new Date()) {
122
126
  }
123
127
  if (options.selfExtractingArchive) {
124
128
  extraDataOffset = await prependHTMLData(pageData, zipDataWriter, script, options);
129
+ } else if (!options.embeddedImage && options.embeddedPdf) {
130
+ await writeData(zipDataWriter.writable, new Uint8Array(options.embeddedPdf));
125
131
  }
126
132
  const zipWriter = new ZipWriter(zipDataWriter, { bufferedWrite: true, keepOrder: false, lastModDate });
127
133
  const startOffset = zipDataWriter.offset;