find-files.d.ts 988 B

12345678910111213141516171819202122232425262728
  1. /// <reference types="node" />
  2. import * as fs from 'fs';
  3. /**
  4. * Returns files inside given file path.
  5. *
  6. * @param path file path.
  7. */
  8. export declare function readDirectory(path: string): Promise<string[]>;
  9. /**
  10. * Returns file stats object for given file path.
  11. *
  12. * @param path path to file or directory.
  13. */
  14. export declare function getStats(path: string): Promise<fs.Stats>;
  15. interface FindFilesRes {
  16. files: string[];
  17. allFilesFound: string[];
  18. }
  19. /**
  20. * Find all files in given search path. Returns paths to files found.
  21. *
  22. * @param path file path to search.
  23. * @param ignore (optional) files to ignore. Will always ignore node_modules.
  24. * @param filter (optional) file names to find. If not provided all files are returned.
  25. * @param levelsDeep (optional) how many levels deep to search, defaults to two, this path and one sub directory.
  26. */
  27. export declare function find(path: string, ignore?: string[], filter?: string[], levelsDeep?: number): Promise<FindFilesRes>;
  28. export {};