15815213711
2024-08-26 67b8b6731811983447e053d4396b3708c14dfe3c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { file, withFile, dir, withDir, tmpName } from ".";
 
async function fileExample() {
  const { path, fd, cleanup } = await file({ discardDescriptor: true });
  await cleanup();
 
  await withFile(
    async ({ path, fd, cleanup }) => {
      console.log(fd);
      await cleanup();
    },
    { discardDescriptor: true }
  );
}
 
async function dirExample() {
  const { path, cleanup } = await dir({ unsafeCleanup: true });
  await cleanup();
 
  await withDir(
    async ({ path, cleanup }) => {
      console.log(path);
      await cleanup();
    },
    { unsafeCleanup: true }
  );
}
 
async function tmpNameExample() {
  const name = await tmpName({ tries: 3 });
}