updater.d.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { TargetFile } from '@tufjs/models';
  2. import { Config } from './config';
  3. import { Fetcher } from './fetcher';
  4. export interface UpdaterOptions {
  5. metadataDir: string;
  6. metadataBaseUrl: string;
  7. targetDir?: string;
  8. targetBaseUrl?: string;
  9. fetcher?: Fetcher;
  10. forceCache?: boolean;
  11. config?: Partial<Config>;
  12. }
  13. export declare class Updater {
  14. private dir;
  15. private metadataBaseUrl;
  16. private targetDir?;
  17. private targetBaseUrl?;
  18. private forceCache;
  19. private trustedSet;
  20. private config;
  21. private fetcher;
  22. constructor(options: UpdaterOptions);
  23. refresh(): Promise<void>;
  24. getTargetInfo(targetPath: string): Promise<TargetFile | undefined>;
  25. downloadTarget(targetInfo: TargetFile, filePath?: string, targetBaseUrl?: string): Promise<string>;
  26. findCachedTarget(targetInfo: TargetFile, filePath?: string): Promise<string | undefined>;
  27. private loadLocalMetadata;
  28. private loadRoot;
  29. private loadTimestamp;
  30. private loadSnapshot;
  31. private loadTargets;
  32. private preorderDepthFirstWalk;
  33. private generateTargetPath;
  34. private persistMetadata;
  35. }