UNPKG

3.55 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 * A function allowing customization of the url returned
29 * from getArtifactRemoteURL().
30 */
31 resolveAssetURL?: (opts: DownloadOptions) => Promise<string>;
32}
33export interface ElectronDownloadRequest {
34 /**
35 * The version of Electron associated with the artifact.
36 */
37 version: string;
38 /**
39 * The type of artifact. For example:
40 * * `electron`
41 * * `ffmpeg`
42 */
43 artifactName: string;
44}
45export interface ElectronDownloadRequestOptions {
46 /**
47 * Whether to download an artifact regardless of whether it's in the cache directory.
48 *
49 * Defaults to `false`.
50 */
51 force?: boolean;
52 /**
53 * When set to `true`, disables checking that the artifact download completed successfully
54 * with the correct payload.
55 *
56 * Defaults to `false`.
57 */
58 unsafelyDisableChecksums?: boolean;
59 /**
60 * The directory that caches Electron artifact downloads.
61 *
62 * The default value is dependent upon the host platform:
63 *
64 * * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
65 * * MacOS: `~/Library/Caches/electron/`
66 * * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
67 */
68 cacheRoot?: string;
69 /**
70 * Options passed to the downloader module.
71 */
72 downloadOptions?: DownloadOptions;
73 /**
74 * Options related to specifying an artifact mirror.
75 */
76 mirrorOptions?: MirrorOptions;
77 /**
78 * The custom [[Downloader]] class used to download artifacts. Defaults to the
79 * built-in [[GotDownloader]].
80 */
81 downloader?: Downloader<DownloadOptions>;
82 /**
83 * A temporary directory for downloads.
84 * It is used before artifacts are put into cache.
85 */
86 tempDirectory?: string;
87}
88export declare type ElectronPlatformArtifactDetails = {
89 /**
90 * The target artifact platform. These are Node-style platform names, for example:
91 * * `win32`
92 * * `darwin`
93 * * `linux`
94 */
95 platform: string;
96 /**
97 * The target artifact architecture. These are Node-style architecture names, for example:
98 * * `ia32`
99 * * `x64`
100 * * `armv7l`
101 */
102 arch: string;
103 artifactSuffix?: string;
104 isGeneric?: false;
105} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
106export declare type ElectronGenericArtifactDetails = {
107 isGeneric: true;
108} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
109export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
110export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
111export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
112 platform?: string;
113 arch?: string;
114}) | ElectronGenericArtifactDetails;