aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/ui/src/types/bindings/downloader.ts
blob: f2be278914278a44074168919f89b3b83556542d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

/**
 * Metadata for resumable downloads stored in .part.meta file
 */
export type DownloadMetadata = {
  url: string;
  fileName: string;
  totalSize: bigint;
  downloadedBytes: bigint;
  checksum: string | null;
  timestamp: bigint;
  segments: Array<DownloadSegment>;
};

/**
 * Download queue for persistence
 */
export type DownloadQueue = { pendingDownloads: Array<PendingJavaDownload> };

/**
 * A download segment for multi-segment parallel downloading
 */
export type DownloadSegment = {
  start: bigint;
  end: bigint;
  downloaded: bigint;
  completed: boolean;
};

export type DownloadTask = {
  url: string;
  path: string;
  sha1: string | null;
  sha256: string | null;
};

/**
 * Progress event for Java download
 */
export type JavaDownloadProgress = {
  fileName: string;
  downloadedBytes: bigint;
  totalBytes: bigint;
  speedBytesPerSec: bigint;
  etaSeconds: bigint;
  status: string;
  percentage: number;
};

/**
 * Pending download task for queue persistence
 */
export type PendingJavaDownload = {
  majorVersion: number;
  imageType: string;
  downloadUrl: string;
  fileName: string;
  fileSize: bigint;
  checksum: string | null;
  installPath: string;
  createdAt: bigint;
};

export type ProgressEvent = {
  file: string;
  downloaded: bigint;
  total: bigint;
  status: string;
  completedFiles: number;
  totalFiles: number;
  totalDownloadedBytes: bigint;
};