fsevents.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. declare type Event = "created" | "cloned" | "modified" | "deleted" | "moved" | "root-changed" | "unknown";
  2. declare type Type = "file" | "directory" | "symlink";
  3. declare type FileChanges = {
  4. inode: boolean;
  5. finder: boolean;
  6. access: boolean;
  7. xattrs: boolean;
  8. };
  9. declare type Info = {
  10. event: Event;
  11. path: string;
  12. type: Type;
  13. changes: FileChanges;
  14. flags: number;
  15. };
  16. declare type WatchHandler = (path: string, flags: number, id: string) => void;
  17. export declare function watch(path: string, handler: WatchHandler): () => Promise<void>;
  18. export declare function watch(path: string, since: number, handler: WatchHandler): () => Promise<void>;
  19. export declare function getInfo(path: string, flags: number): Info;
  20. export 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. };
  46. export {};