DownloaderBase.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import { Event } from './Event';
  2. export interface IRequestProgress {
  3. percent: number;
  4. speed: number;
  5. size: {
  6. total: number;
  7. transferred: number;
  8. };
  9. time: {
  10. elapsed: number;
  11. remaining: number;
  12. };
  13. }
  14. export declare abstract class DownloaderBase {
  15. onProgress: Event<IRequestProgress>;
  16. static readonly DEFAULT_DESTINATION: string;
  17. protected destination: string;
  18. abstract fetch(): Promise<string>;
  19. protected abstract handleVersion(version: string): Promise<string>;
  20. fetchAndExtract(): Promise<string>;
  21. protected getVersions(): Promise<any>;
  22. protected setDestination(destination: string): void;
  23. protected handlePlatform(platform: string): "linux" | "win" | "osx";
  24. protected handleArch(arch: string): "ia32" | "x64";
  25. protected getLocalSize(path: string): Promise<number>;
  26. protected getRemoteSize(url: string): Promise<number>;
  27. protected isFileExists(path: string): Promise<{}>;
  28. protected isFileSynced(url: string, path: string): Promise<boolean>;
  29. protected download(url: string, filename: string, path: string, showProgress: boolean): Promise<string>;
  30. }