aboutsummaryrefslogtreecommitdiff
path: root/src/util/paths.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/paths.ts')
-rw-r--r--src/util/paths.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util/paths.ts b/src/util/paths.ts
new file mode 100644
index 0000000..8cd9961
--- /dev/null
+++ b/src/util/paths.ts
@@ -0,0 +1,9 @@
+import { randomUUID } from "node:crypto";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+
+export const screenshotPath = (namespace: string, ext: "png" | "jpeg" = "png"): string =>
+ join(tmpdir(), `pi-browser-screenshot-${namespace}-${randomUUID()}.${ext}`);
+
+export const pdfPath = (namespace: string): string =>
+ join(tmpdir(), `pi-browser-pdf-${namespace}-${randomUUID()}.pdf`);