file_manager.d.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { Binary, BinaryMap } from '../binaries';
  2. import { DownloadedBinary } from './downloaded_binary';
  3. /**
  4. * The File Manager class is where the webdriver manager will compile a list of
  5. * binaries that could be downloaded and get a list of previously downloaded
  6. * file versions.
  7. */
  8. export declare class FileManager {
  9. /**
  10. * Create a directory if it does not exist.
  11. * @param outputDir The directory to create.
  12. */
  13. static makeOutputDirectory(outputDir: string): void;
  14. /**
  15. * For the operating system, check against the list of operating systems that the
  16. * binary is available for.
  17. * @param osType The operating system.
  18. * @param binary The class type to have access to the static properties.
  19. * @returns If the binary is available for the operating system.
  20. */
  21. static checkOS_(osType: string, binary: typeof Binary): boolean;
  22. /**
  23. * For the operating system, create a list that includes the binaries
  24. * for selenium standalone, chrome, and internet explorer.
  25. * @param osType The operating system.
  26. * @param alternateCDN URL of the alternative CDN to be used instead of the default ones.
  27. * @returns A binary map that are available for the operating system.
  28. */
  29. static compileBinaries_(osType: string, alternateCDN?: string): BinaryMap<Binary>;
  30. /**
  31. * Look up the operating system and compile a list of binaries that are available
  32. * for the system.
  33. * @param alternateCDN URL of the alternative CDN to be used instead of the default ones.
  34. * @returns A binary map that is available for the operating system.
  35. */
  36. static setupBinaries(alternateCDN?: string): BinaryMap<Binary>;
  37. /**
  38. * Get the list of existing files from the output directory
  39. * @param outputDir The directory where binaries are saved
  40. * @returns A list of existing files.
  41. */
  42. static getExistingFiles(outputDir: string): string[];
  43. /**
  44. * For the binary, operating system, and system architecture, look through
  45. * the existing files and the downloaded binary
  46. * @param binary The binary of interest
  47. * @param osType The operating system.
  48. * @param existingFiles A list of existing files.
  49. * @returns The downloaded binary with all the versions found.
  50. */
  51. static downloadedVersions_<T extends Binary>(binary: T, osType: string, arch: string, existingFiles: string[]): DownloadedBinary;
  52. /**
  53. * Finds all the downloaded binary versions stored in the output directory.
  54. * @param outputDir The directory where files are downloaded and stored.
  55. * @returns An dictionary map of all the downloaded binaries found in the output folder.
  56. */
  57. static downloadedBinaries(outputDir: string): BinaryMap<DownloadedBinary>;
  58. /**
  59. * Try to download the binary version.
  60. * @param binary The binary of interest.
  61. * @param outputDir The directory where files are downloaded and stored.
  62. * @returns Promise resolved to true for files downloaded, resolved to false for files not
  63. * downloaded because they exist, rejected if there is an error.
  64. */
  65. static downloadFile<T extends Binary>(binary: T, outputDir: string, callback?: Function): Promise<boolean>;
  66. /**
  67. * Removes the existing files found in the output directory that match the
  68. * binary prefix names.
  69. * @param outputDir The directory where files are downloaded and stored.
  70. */
  71. static removeExistingFiles(outputDir: string): void;
  72. }