io.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * Interface for cp/mv options
  3. */
  4. export interface CopyOptions {
  5. /** Optional. Whether to recursively copy all subdirectories. Defaults to false */
  6. recursive?: boolean;
  7. /** Optional. Whether to overwrite existing files in the destination. Defaults to true */
  8. force?: boolean;
  9. }
  10. /**
  11. * Interface for cp/mv options
  12. */
  13. export interface MoveOptions {
  14. /** Optional. Whether to overwrite existing files in the destination. Defaults to true */
  15. force?: boolean;
  16. }
  17. /**
  18. * Copies a file or folder.
  19. * Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
  20. *
  21. * @param source source path
  22. * @param dest destination path
  23. * @param options optional. See CopyOptions.
  24. */
  25. export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
  26. /**
  27. * Moves a path.
  28. *
  29. * @param source source path
  30. * @param dest destination path
  31. * @param options optional. See MoveOptions.
  32. */
  33. export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
  34. /**
  35. * Remove a path recursively with force
  36. *
  37. * @param inputPath path to remove
  38. */
  39. export declare function rmRF(inputPath: string): Promise<void>;
  40. /**
  41. * Make a directory. Creates the full path with folders in between
  42. * Will throw if it fails
  43. *
  44. * @param fsPath path to create
  45. * @returns Promise<void>
  46. */
  47. export declare function mkdirP(fsPath: string): Promise<void>;
  48. /**
  49. * Returns path of a tool had the tool actually been invoked. Resolves via paths.
  50. * If you check and the tool does not exist, it will throw.
  51. *
  52. * @param tool name of the tool
  53. * @param check whether to check if tool exists
  54. * @returns Promise<string> path to tool
  55. */
  56. export declare function which(tool: string, check?: boolean): Promise<string>;