util.d.ts 1.2 KB

1234567891011121314151617181920212223242526272829
  1. import { ExecOptions } from 'child_process';
  2. /**
  3. * Check if file exists
  4. *
  5. * @param filePath file path
  6. * @returns does the file exist
  7. */
  8. export declare const exists: (filePath: string) => Promise<boolean>;
  9. /**
  10. * Resolve file path with `PLUGIN_DATA_DIR`
  11. *
  12. * @param fileName file name
  13. * @returns absolute path
  14. */
  15. export declare const resolvePath: (fileName: string) => string;
  16. export declare const mkdir: (dirname: string) => Promise<void>;
  17. export declare const ensureDirExist: (filePath: string) => Promise<void>;
  18. export declare const readFile: (filePath: string) => Promise<string>;
  19. export declare const writeFile: (filePath: string, data: string | Uint8Array) => Promise<void>;
  20. export declare const exec: (cmd: string, options?: ExecOptions) => Promise<{
  21. stdout: string;
  22. stderr: string;
  23. }>;
  24. export declare const getLocalV4Ips: () => string[];
  25. export declare const getDefaultHosts: () => string[];
  26. export declare const getHash: (filePath: string) => Promise<string>;
  27. export declare const deepMerge: (target: any, ...source: any[]) => any;
  28. export declare const prettyLog: (obj?: Record<string, any>) => string;
  29. export declare const escape: (path?: string) => string;