UNPKG

4.12 kBTypeScriptView Raw
1import { Downloader } from './Downloader';
2export declare type DownloadOptions = any;
3export interface MirrorOptions {
4 /**
5 * DEPRECATED - see nightlyMirror.
6 */
7 nightly_mirror?: string;
8 /**
9 * The Electron nightly-specific mirror URL.
10 */
11 nightlyMirror?: string;
12 /**
13 * The base URL of the mirror to download from,
14 * e.g https://github.com/electron/electron/releases/download
15 */
16 mirror?: string;
17 /**
18 * The name of the directory to download from,
19 * often scoped by version number e.g 'v4.0.4'
20 */
21 customDir?: string;
22 /**
23 * The name of the asset to download,
24 * e.g 'electron-v4.0.4-linux-x64.zip'
25 */
26 customFilename?: string;
27 /**
28 * The version of the asset to download,
29 * e.g '4.0.4'
30 */
31 customVersion?: string;
32 /**
33 * A function allowing customization of the url returned
34 * from getArtifactRemoteURL().
35 */
36 resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
37}
38export interface ElectronDownloadRequest {
39 /**
40 * The version of Electron associated with the artifact.
41 */
42 version: string;
43 /**
44 * The type of artifact. For example:
45 * * `electron`
46 * * `ffmpeg`
47 */
48 artifactName: string;
49}
50export interface ElectronDownloadRequestOptions {
51 /**
52 * Whether to download an artifact regardless of whether it's in the cache directory.
53 *
54 * Defaults to `false`.
55 */
56 force?: boolean;
57 /**
58 * When set to `true`, disables checking that the artifact download completed successfully
59 * with the correct payload.
60 *
61 * Defaults to `false`.
62 */
63 unsafelyDisableChecksums?: boolean;
64 /**
65 * Provides checksums for the artifact as strings.
66 * Can be used if you already know the checksums of the Electron artifact
67 * you are downloading and want to skip the checksum file download
68 * without skipping the checksum validation.
69 *
70 * This should be an object whose keys are the file names of the artifacts and
71 * the values are their respective SHA256 checksums.
72 */
73 checksums?: Record<string, string>;
74 /**
75 * The directory that caches Electron artifact downloads.
76 *
77 * The default value is dependent upon the host platform:
78 *
79 * * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
80 * * MacOS: `~/Library/Caches/electron/`
81 * * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
82 */
83 cacheRoot?: string;
84 /**
85 * Options passed to the downloader module.
86 */
87 downloadOptions?: DownloadOptions;
88 /**
89 * Options related to specifying an artifact mirror.
90 */
91 mirrorOptions?: MirrorOptions;
92 /**
93 * The custom [[Downloader]] class used to download artifacts. Defaults to the
94 * built-in [[GotDownloader]].
95 */
96 downloader?: Downloader<DownloadOptions>;
97 /**
98 * A temporary directory for downloads.
99 * It is used before artifacts are put into cache.
100 */
101 tempDirectory?: string;
102}
103export declare type ElectronPlatformArtifactDetails = {
104 /**
105 * The target artifact platform. These are Node-style platform names, for example:
106 * * `win32`
107 * * `darwin`
108 * * `linux`
109 */
110 platform: string;
111 /**
112 * The target artifact architecture. These are Node-style architecture names, for example:
113 * * `ia32`
114 * * `x64`
115 * * `armv7l`
116 */
117 arch: string;
118 artifactSuffix?: string;
119 isGeneric?: false;
120} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
121export declare type ElectronGenericArtifactDetails = {
122 isGeneric: true;
123} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
124export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
125export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
126export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
127 platform?: string;
128 arch?: string;
129}) | ElectronGenericArtifactDetails;