updater.d.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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. config?: Partial<Config>;
  11. }
  12. export declare class Updater {
  13. private dir;
  14. private metadataBaseUrl;
  15. private targetDir?;
  16. private targetBaseUrl?;
  17. private trustedSet;
  18. private config;
  19. private fetcher;
  20. constructor(options: UpdaterOptions);
  21. refresh(): Promise<void>;
  22. getTargetInfo(targetPath: string): Promise<TargetFile | undefined>;
  23. downloadTarget(targetInfo: TargetFile, filePath?: string, targetBaseUrl?: string): Promise<string>;
  24. findCachedTarget(targetInfo: TargetFile, filePath?: string): Promise<string | undefined>;
  25. private loadLocalMetadata;
  26. private loadRoot;
  27. private loadTimestamp;
  28. private loadSnapshot;
  29. private loadTargets;
  30. private preorderDepthFirstWalk;
  31. private generateTargetPath;
  32. private persistMetadata;
  33. }