file.d.ts 1.2 KB

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