GHHG10's picture
download
raw
687 Bytes
import fs from "fs/promises"
import { tmpdir as osTmpdir } from "os"
import path from "path"
export const tmpdir = async () => {
const dir = await fs.realpath(await fs.mkdtemp(path.join(osTmpdir(), "opencode-core-test-")))
return {
path: dir,
async [Symbol.asyncDispose]() {
await remove(dir)
},
}
}
async function remove(dir: string, retries = 30): Promise<void> {
try {
await fs.rm(dir, { recursive: true, force: true })
} catch (error) {
if (retries === 0 || !error || typeof error !== "object" || !("code" in error) || error.code !== "EBUSY")
throw error
Bun.gc(true)
await Bun.sleep(100)
return remove(dir, retries - 1)
}
}

Xet Storage Details

Size:
687 Bytes
·
Xet hash:
9ec9e1d6f2710355b839183219fa2baa44633328d6e7751e05c432c61cfd256d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.