UNPKG

1.43 kBTypeScriptView Raw
1declare type Event = "created" | "cloned" | "modified" | "deleted" | "moved" | "root-changed" | "unknown";
2declare type Type = "file" | "directory" | "symlink";
3declare type FileChanges = {
4 inode: boolean;
5 finder: boolean;
6 access: boolean;
7 xattrs: boolean;
8};
9declare type Info = {
10 event: Event;
11 path: string;
12 type: Type;
13 changes: FileChanges;
14 flags: number;
15};
16declare type WatchHandler = (path: string, flags: number, id: string) => void;
17export declare function watch(path: string, handler: WatchHandler): () => Promise<void>;
18export declare function watch(path: string, since: number, handler: WatchHandler): () => Promise<void>;
19export declare function getInfo(path: string, flags: number): Info;
20export declare const constants: {
21 None: 0x00000000;
22 MustScanSubDirs: 0x00000001;
23 UserDropped: 0x00000002;
24 KernelDropped: 0x00000004;
25 EventIdsWrapped: 0x00000008;
26 HistoryDone: 0x00000010;
27 RootChanged: 0x00000020;
28 Mount: 0x00000040;
29 Unmount: 0x00000080;
30 ItemCreated: 0x00000100;
31 ItemRemoved: 0x00000200;
32 ItemInodeMetaMod: 0x00000400;
33 ItemRenamed: 0x00000800;
34 ItemModified: 0x00001000;
35 ItemFinderInfoMod: 0x00002000;
36 ItemChangeOwner: 0x00004000;
37 ItemXattrMod: 0x00008000;
38 ItemIsFile: 0x00010000;
39 ItemIsDir: 0x00020000;
40 ItemIsSymlink: 0x00040000;
41 ItemIsHardlink: 0x00100000;
42 ItemIsLastHardlink: 0x00200000;
43 OwnEvent: 0x00080000;
44 ItemCloned: 0x00400000;
45};
46export {};