install.d.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**
  2. * Copyright 2017 Google Inc. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import { Browser, BrowserPlatform } from './browser-data/browser-data.js';
  17. import { InstalledBrowser } from './Cache.js';
  18. /**
  19. * @public
  20. */
  21. export interface InstallOptions {
  22. /**
  23. * Determines the path to download browsers to.
  24. */
  25. cacheDir: string;
  26. /**
  27. * Determines which platform the browser will be suited for.
  28. *
  29. * @defaultValue **Auto-detected.**
  30. */
  31. platform?: BrowserPlatform;
  32. /**
  33. * Determines which browser to install.
  34. */
  35. browser: Browser;
  36. /**
  37. * Determines which buildId to download. BuildId should uniquely identify
  38. * binaries and they are used for caching.
  39. */
  40. buildId: string;
  41. /**
  42. * Provides information about the progress of the download.
  43. */
  44. downloadProgressCallback?: (downloadedBytes: number, totalBytes: number) => void;
  45. /**
  46. * Determines the host that will be used for downloading.
  47. *
  48. * @defaultValue Either
  49. *
  50. * - https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing or
  51. * - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central
  52. *
  53. */
  54. baseUrl?: string;
  55. /**
  56. * Whether to unpack and install browser archives.
  57. *
  58. * @defaultValue `true`
  59. */
  60. unpack?: boolean;
  61. }
  62. /**
  63. * @public
  64. */
  65. export declare function install(options: InstallOptions): Promise<InstalledBrowser>;
  66. /**
  67. * @public
  68. */
  69. export interface UninstallOptions {
  70. /**
  71. * Determines the platform for the browser binary.
  72. *
  73. * @defaultValue **Auto-detected.**
  74. */
  75. platform?: BrowserPlatform;
  76. /**
  77. * The path to the root of the cache directory.
  78. */
  79. cacheDir: string;
  80. /**
  81. * Determines which browser to uninstall.
  82. */
  83. browser: Browser;
  84. /**
  85. * The browser build to uninstall
  86. */
  87. buildId: string;
  88. }
  89. /**
  90. *
  91. * @public
  92. */
  93. export declare function uninstall(options: UninstallOptions): Promise<void>;
  94. /**
  95. * @public
  96. */
  97. export interface GetInstalledBrowsersOptions {
  98. /**
  99. * The path to the root of the cache directory.
  100. */
  101. cacheDir: string;
  102. }
  103. /**
  104. * Returns metadata about browsers installed in the cache directory.
  105. *
  106. * @public
  107. */
  108. export declare function getInstalledBrowsers(options: GetInstalledBrowsersOptions): Promise<InstalledBrowser[]>;
  109. /**
  110. * @public
  111. */
  112. export declare function canDownload(options: InstallOptions): Promise<boolean>;
  113. //# sourceMappingURL=install.d.ts.map