1
0

tmpdir.ts 339 B

12345678910111213
  1. import fs from "fs/promises"
  2. import { tmpdir as osTmpdir } from "os"
  3. import path from "path"
  4. export const tmpdir = async () => {
  5. const dir = await fs.mkdtemp(path.join(osTmpdir(), "opencode-core-test-"))
  6. return {
  7. path: dir,
  8. async [Symbol.asyncDispose]() {
  9. await fs.rm(dir, { recursive: true, force: true })
  10. },
  11. }
  12. }