io-util.d.ts 1.7 KB

1234567891011121314151617181920212223242526272829
  1. /// <reference types="node" />
  2. import * as fs from 'fs';
  3. export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
  4. export declare const IS_WINDOWS: boolean;
  5. export declare function exists(fsPath: string): Promise<boolean>;
  6. export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
  7. /**
  8. * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
  9. * \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
  10. */
  11. export declare function isRooted(p: string): boolean;
  12. /**
  13. * Recursively create a directory at `fsPath`.
  14. *
  15. * This implementation is optimistic, meaning it attempts to create the full
  16. * path first, and backs up the path stack from there.
  17. *
  18. * @param fsPath The path to create
  19. * @param maxDepth The maximum recursion depth
  20. * @param depth The current recursion depth
  21. */
  22. export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
  23. /**
  24. * Best effort attempt to determine whether a file exists and is executable.
  25. * @param filePath file path to check
  26. * @param extensions additional file extensions to try
  27. * @return if file exists and is executable, returns the file path. otherwise empty string.
  28. */
  29. export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;