-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.ts
66 lines (52 loc) · 1.27 KB
/
types.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
import fs from "node:fs";
export type QAR = {
readonly header: QARHeader;
readonly footer: QARFooter;
readonly hash: Buffer;
readonly realHash: Buffer;
readonly files: string[][];
readonly fileDescriptor: number;
readonly path: string;
readonly stats: fs.Stats;
verifyIntegrity(): boolean;
readFileSync(file: string | string[]): Buffer;
readFile(file: string | string[]): Promise<Buffer>;
invalidateCache(): void;
close(): void;
};
export type DeepPartial<T> = T extends object
? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;
export type QARHeader = {
version: number;
compression: { name: string; options: any; chunkSize: number };
};
export type QARFooter = FolderChildren;
export type FolderChildren = Record<string, File | Folder | Symlink>;
export enum FileType {
FILE = "FILE",
SYMLINK = "SYMLINK",
FOLDER = "FOLDER",
}
export type Folder = {
type: FileType.FOLDER;
children: FolderChildren;
};
export type File = {
type: FileType.FILE;
offset: number;
length: number;
size: number;
chunks: number[];
};
export type Symlink = {
type: FileType.SYMLINK;
target: string[];
};
export type EmbedArray = {
type?: FileType.FILE | FileType.SYMLINK;
from: string;
to: string[];
}[];