single-file-cli 2.0.61 → 2.0.63
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/Dockerfile +4 -4
- package/build.sh +1 -1
- package/deno.json +1 -1
- package/lib/cdp-client.js +1 -1
- package/lib/single-file-bundle.js +1 -1
- package/lib/version.js +1 -1
- package/options.js +2 -1
- package/package.json +1 -1
- package/single-file-cli-api.js +5 -4
- package/single-file-launcher.js +3 -0
package/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "2.0.
|
|
1
|
+
export const version = "2.0.63";
|
package/options.js
CHANGED
|
@@ -133,8 +133,9 @@ const OPTIONS_INFO = {
|
|
|
133
133
|
"prevent-appended-data": { description: "Prevent appending data after the compressed data when creating self-extracting HTML files", type: "boolean" },
|
|
134
134
|
"embed-screenshot": { description: "Embed a screenshot of the page as a PNG file in the compressed file (self-extracting HTML or ZIP file). When enabled, the resulting file can be read as a ZIP file or a PNG image.", type: "boolean" },
|
|
135
135
|
"embedded-image": { description: "Path to a PNG image to embed in the compressed file.", type: "string" },
|
|
136
|
-
"embed-pdf": { description: "Embed a PDF file in the self-extracting
|
|
136
|
+
"embed-pdf": { description: "Embed a PDF file in the ZIP or self-extracting file. When enabled, the resulting file can be read as a ZIP file or a PDF file.", type: "boolean" },
|
|
137
137
|
"embed-pdf-options": { description: "Options passed to the CDP method `Page.printToPDF()` given as a JSON string (e.g. { \"pageRanges\": \"1-1\", \"paperWidth\": 11, \"paperHeight\": 8.5 })", type: "string" },
|
|
138
|
+
"embedded-pdf": { description: "Path to a PDF file to embed in the compressed file.", type: "string" },
|
|
138
139
|
"output-directory": { description: "Path to where to save files, this path must exist.", type: "string" },
|
|
139
140
|
"version": { description: "Print the version number and exit.", type: "boolean" },
|
|
140
141
|
"output-json": { description: "Output the result as a JSON string containing the page and network info", type: "boolean" },
|
package/package.json
CHANGED
package/single-file-cli-api.js
CHANGED
|
@@ -247,7 +247,6 @@ async function capturePage(options) {
|
|
|
247
247
|
let filename, content;
|
|
248
248
|
options.zipScript = getZipScriptSource();
|
|
249
249
|
const pageData = await backend.getPageData(options);
|
|
250
|
-
filename = pageData.filename;
|
|
251
250
|
content = pageData.content;
|
|
252
251
|
if (options.outputJson) {
|
|
253
252
|
if (content instanceof Uint8Array) {
|
|
@@ -263,7 +262,6 @@ async function capturePage(options) {
|
|
|
263
262
|
pageData.doctype = undefined;
|
|
264
263
|
pageData.viewport = undefined;
|
|
265
264
|
pageData.comment = undefined;
|
|
266
|
-
filename += filename.endsWith(".json") ? "" : ".json";
|
|
267
265
|
content = JSON.stringify(pageData, null, 2);
|
|
268
266
|
}
|
|
269
267
|
if (options.output) {
|
|
@@ -275,9 +273,12 @@ async function capturePage(options) {
|
|
|
275
273
|
console.log(content || ""); // eslint-disable-line no-console
|
|
276
274
|
}
|
|
277
275
|
} else {
|
|
278
|
-
filename = await getFilename(filename, options);
|
|
276
|
+
filename = await getFilename(pageData.filename, options);
|
|
279
277
|
}
|
|
280
|
-
if (filename
|
|
278
|
+
if (filename) {
|
|
279
|
+
if (options.outputJson) {
|
|
280
|
+
filename += filename.endsWith(".json") ? "" : ".json";
|
|
281
|
+
}
|
|
281
282
|
const directoryName = await path.dirname(filename);
|
|
282
283
|
if (directoryName !== ".") {
|
|
283
284
|
await mkdir(directoryName, { recursive: true });
|
package/single-file-launcher.js
CHANGED
|
@@ -95,6 +95,9 @@ async function run() {
|
|
|
95
95
|
if (options.embeddedImage) {
|
|
96
96
|
options.embeddedImage = Array.from(await readFile(options.embeddedImage));
|
|
97
97
|
}
|
|
98
|
+
if (options.embeddedPdf) {
|
|
99
|
+
options.embeddedPdf = Array.from(await readFile(options.embeddedPdf));
|
|
100
|
+
}
|
|
98
101
|
options.retrieveLinks = true;
|
|
99
102
|
const singlefile = await initialize(options);
|
|
100
103
|
await singlefile.capture(urls);
|