@eighty4/c2
Version:
Cross platform cloud config tooling for cloud-init
15 lines (14 loc) • 474 B
JavaScript
import { mkdtemp, rm } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
export async function makeFile(path, content, pathPrefix) {
const p = !!pathPrefix ? join(pathPrefix, path) : path;
await Bun.file(p).write(content);
return p;
}
export async function makeTempDir() {
return await mkdtemp(join(tmpdir(), 'c2-test-'));
}
export async function removeDir(p) {
await rm(p, { force: true, recursive: true });
}