file.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /// <reference types="node" />
  2. /// <reference types="node" />
  3. import { Readable } from 'stream';
  4. import { JSONObject, JSONValue } from './utils';
  5. interface MetaFileOptions {
  6. version: number;
  7. length?: number;
  8. hashes?: Record<string, string>;
  9. unrecognizedFields?: Record<string, JSONValue>;
  10. }
  11. export declare class MetaFile {
  12. readonly version: number;
  13. readonly length?: number;
  14. readonly hashes?: Record<string, string>;
  15. readonly unrecognizedFields?: Record<string, JSONValue>;
  16. constructor(opts: MetaFileOptions);
  17. equals(other: MetaFile): boolean;
  18. verify(data: Buffer): void;
  19. toJSON(): JSONObject;
  20. static fromJSON(data: JSONObject): MetaFile;
  21. }
  22. interface TargetFileOptions {
  23. length: number;
  24. path: string;
  25. hashes: Record<string, string>;
  26. unrecognizedFields?: Record<string, JSONValue>;
  27. }
  28. export declare class TargetFile {
  29. readonly length: number;
  30. readonly path: string;
  31. readonly hashes: Record<string, string>;
  32. readonly unrecognizedFields: Record<string, JSONValue>;
  33. constructor(opts: TargetFileOptions);
  34. get custom(): Record<string, unknown>;
  35. equals(other: TargetFile): boolean;
  36. verify(stream: Readable): Promise<void>;
  37. toJSON(): JSONObject;
  38. static fromJSON(path: string, data: JSONObject): TargetFile;
  39. }
  40. export {};