UNPKG

4.01 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 * Provides checksums for the artifact as strings.
61 * Can be used if you already know the checksums of the Electron artifact
62 * you are downloading and want to skip the checksum file download
63 * without skipping the checksum validation.
64 *
65 * This should be an object whose keys are the file names of the artifacts and
66 * the values are their respective SHA256 checksums.
67 */
68 checksums?: Record<string, string>;
69 /**
70 * The directory that caches Electron artifact downloads.
71 *
72 * The default value is dependent upon the host platform:
73 *
74 * * Linux: `$XDG_CACHE_HOME` or `~/.cache/electron/`
75 * * MacOS: `~/Library/Caches/electron/`
76 * * Windows: `%LOCALAPPDATA%/electron/Cache` or `~/AppData/Local/electron/Cache/`
77 */
78 cacheRoot?: string;
79 /**
80 * Options passed to the downloader module.
81 */
82 downloadOptions?: DownloadOptions;
83 /**
84 * Options related to specifying an artifact mirror.
85 */
86 mirrorOptions?: MirrorOptions;
87 /**
88 * The custom [[Downloader]] class used to download artifacts. Defaults to the
89 * built-in [[GotDownloader]].
90 */
91 downloader?: Downloader<DownloadOptions>;
92 /**
93 * A temporary directory for downloads.
94 * It is used before artifacts are put into cache.
95 */
96 tempDirectory?: string;
97}
98export declare type ElectronPlatformArtifactDetails = {
99 /**
100 * The target artifact platform. These are Node-style platform names, for example:
101 * * `win32`
102 * * `darwin`
103 * * `linux`
104 */
105 platform: string;
106 /**
107 * The target artifact architecture. These are Node-style architecture names, for example:
108 * * `ia32`
109 * * `x64`
110 * * `armv7l`
111 */
112 arch: string;
113 artifactSuffix?: string;
114 isGeneric?: false;
115} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
116export declare type ElectronGenericArtifactDetails = {
117 isGeneric: true;
118} & ElectronDownloadRequest & ElectronDownloadRequestOptions;
119export declare type ElectronArtifactDetails = ElectronPlatformArtifactDetails | ElectronGenericArtifactDetails;
120export declare type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
121export declare type ElectronPlatformArtifactDetailsWithDefaults = (Omit<ElectronPlatformArtifactDetails, 'platform' | 'arch'> & {
122 platform?: string;
123 arch?: string;
124}) | ElectronGenericArtifactDetails;