import { mkdtemp, rm } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'

export const createChromeProfile = (name) => mkdtemp(join(tmpdir(), `bitbybit-${name}-`))

export const removeChromeProfile = (profile) => rm(profile, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 })
