lino-levan / astral

A high-level puppeteer/playwright-like library for Deno
https://jsr.io/@astral/astral
MIT License
215 stars 10 forks source link

Configurable tempDir or at least exposing it some how #56

Closed Sembiance closed 3 months ago

Sembiance commented 6 months ago

I'm launching several hundred browser sessions, each one utilizes Deno.makeTempDirSync() to get where to store the browsers user-data-dir. It would be awesome if LaunchOptions had a userDataDir option to override this behavior, so I could have them be generated on a seperate drive that has more disk space available. At the very least returning or making available which temporary directory it created would be great, so I can properly cleanup the files afterwards.

lino-levan commented 6 months ago

Interesting use case, this definitely makes sense to solve. Let me think about this.

Sembiance commented 3 months ago

Since astral just uses Deno.makeTempDirSync() a good work-around is simply setting the TMPDIR env var before including or using astral like so:

Deno.env.set("TMPDIR", "/mnt/drive2/tmp");
import {launch} from "jsr:@astral/astral@0.4.2";

I think this is a perfectly acceptable way of handling things and don't think astral needs to spend any dev time adding in it's own way. Thanks for creating astral :)