binary.d.ts 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { ConfigSource } from './config_source';
  2. /**
  3. * operating system enum
  4. */
  5. export declare enum OS {
  6. Windows_NT = 0,
  7. Linux = 1,
  8. Darwin = 2,
  9. }
  10. export interface BinaryUrl {
  11. url: string;
  12. version: string;
  13. }
  14. /**
  15. * Dictionary to map the binary's id to the binary object
  16. */
  17. export interface BinaryMap<T extends Binary> {
  18. [id: string]: T;
  19. }
  20. export declare abstract class Binary {
  21. static os: OS[];
  22. configSource: ConfigSource;
  23. ostype: string;
  24. osarch: string;
  25. alternativeDownloadUrl: string;
  26. cdn: string;
  27. name: string;
  28. versionDefault: string;
  29. versionCustom: string;
  30. constructor(opt_alternativeCdn?: string);
  31. abstract prefix(): string;
  32. abstract suffix(): string;
  33. executableSuffix(): string;
  34. version(): string;
  35. filename(): string;
  36. /**
  37. * @param ostype The operating system.
  38. * @returns The file name for the executable.
  39. */
  40. executableFilename(): string;
  41. /**
  42. * Gets the id of the binary.
  43. */
  44. abstract id(): string;
  45. /**
  46. * Gets the url to download the file set by the version. This will use the XML if available.
  47. * If not, it will download from an existing url.
  48. *
  49. * @param {string} version The version we are looking for. This could also be 'latest'.
  50. */
  51. getUrl(version?: string): Promise<BinaryUrl>;
  52. /**
  53. * Gets the list of available versions available based on the xml. If no XML exists, return an
  54. * empty list.
  55. */
  56. abstract getVersionList(): Promise<string[]>;
  57. /**
  58. * Delete an instance of this binary from the file system
  59. */
  60. remove(filename: string): void;
  61. /**
  62. * @param ostype The operating system.
  63. * @returns The file name for the file inside the downloaded zip file
  64. */
  65. zipContentName(): string;
  66. }