barebrowse 0.7.1 → 0.9.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/src/daemon.js CHANGED
@@ -39,6 +39,7 @@ export async function startDaemon(opts, outputDir, initialUrl) {
39
39
  if (opts.proxy) args.push('--proxy', opts.proxy);
40
40
  if (opts.viewport) args.push('--viewport', opts.viewport);
41
41
  if (opts.storageState) args.push('--storage-state', opts.storageState);
42
+ if (opts.downloadPath) args.push('--download-path', opts.downloadPath);
42
43
 
43
44
  const child = spawn(process.execPath, args, {
44
45
  detached: true,
@@ -77,6 +78,7 @@ export async function runDaemon(opts, outputDir, initialUrl) {
77
78
  proxy: opts.proxy,
78
79
  viewport: opts.viewport,
79
80
  storageState: opts.storageState,
81
+ downloadPath: opts.downloadPath,
80
82
  });
81
83
 
82
84
  // Console log capture
@@ -208,6 +210,17 @@ export async function runDaemon(opts, outputDir, initialUrl) {
208
210
  return { ok: true };
209
211
  },
210
212
 
213
+ async reload({ ignoreCache }) {
214
+ await page.reload({ ignoreCache: !!ignoreCache });
215
+ return { ok: true };
216
+ },
217
+
218
+ async downloads() {
219
+ // Snapshot the array — callers want a static view at the moment of
220
+ // the request, not a reference that mutates under them.
221
+ return { ok: true, value: page.downloads.map((d) => ({ ...d })) };
222
+ },
223
+
211
224
  async drag({ fromRef, toRef }) {
212
225
  await page.drag(String(fromRef), String(toRef));
213
226
  return { ok: true };