-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fila.cover.ts
67 lines (55 loc) · 1.59 KB
/
Fila.cover.ts
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
namespace Cover
{
/** */
export async function coverFila()
{
const path = (globalThis as any).__TAURI__.path;
const cwdString: string = await path.appDataDir();
const cwd = Fila.new(cwdString);
debugger;
const testFile = cwd.down("file.txt");
await testFile.writeText(Date.now().toString());
const text = await testFile.readText();
console.log(text);
const dir = cwd.down("dir");
await dir.writeDirectory();
await dir.down("a.txt").writeText(Date.now().toString());
await dir.down("b.txt").writeText(Date.now().toString());
await dir.down("c.txt").writeText(Date.now().toString());
await dir.down("a").writeDirectory();
await dir.down("b").writeDirectory();
await dir.down("c").writeDirectory();
{
const file = dir.down("a.txt");
const ac = await file.getAccessedTicks();
const cr = await file.getCreatedTicks();
const mo = await file.getModifiedTicks();
const sz = await file.getSize();
const dr = await file.getDirectory();
debugger;
}
const contents = await dir.readDirectory();
for (const entry of contents)
console.log(entry.path);
const unwatch = dir.watch((ev, fila) =>
{
console.log(ev + " - " + fila.path);
unwatch;
});
}
/** */
export async function coverFilaTauri()
{
const fila = Fila.new("FilaTauri", "+sample");
fila.watch((ev, fila) =>
{
console.log(ev + ": " + fila.path);
});
}
0 && ("__TAURI__" in globalThis) && setTimeout(() =>
{
document.body.addEventListener("click", coverFila, true);
});
}
//@ts-ignore
if (typeof module === "object") Object.assign(module.exports, { Cover });