Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 5x 5x 5x 5x 23x 18x 18x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 19x | import { ComparableVersion } from '../commons/ComparableVersion'
import { ALL_FALSE_FULL_CONFIG } from '../commons/constants'
import type { IChromeFullConfig } from '../interfaces/interfaces'
import type { DownloadReportEntry } from '../interfaces/interfaces'
import type { OS } from '../interfaces/os.interfaces'
import type { Arch } from '../interfaces/store.interfaces'
import { downloadChromium } from './download'
/**
* Allows to setup the configuration for downloading rusted-chromium via a fluent interface.
* If a value is not set, it defaults to "false"
*/
export class FluentDownload {
private config: IChromeFullConfig
public constructor() {
this.config = {
...ALL_FALSE_FULL_CONFIG,
}
}
private addToConfig(pConfig: Partial<IChromeFullConfig>): FluentDownload {
this.config = {
...this.config,
...pConfig,
}
return this
}
public arch(arch: Arch): FluentDownload {
return this.addToConfig({ arch })
}
public autoUnzip(): FluentDownload {
return this.addToConfig({ autoUnzip: true })
}
public debug(): FluentDownload {
return this.addToConfig({ debug: true })
}
public download(): FluentDownload {
return this.addToConfig({ download: true })
}
public downloadFolder(downloadFolder: string): FluentDownload {
return this.addToConfig({ downloadFolder })
}
public hideNegativeHits(): FluentDownload {
return this.addToConfig({ hideNegativeHits: true })
}
public interactive(): FluentDownload {
return this.addToConfig({ interactive: true })
}
public inverse(): FluentDownload {
return this.addToConfig({ inverse: true })
}
public max(comparableVersion: string | ComparableVersion): FluentDownload {
const max = typeof comparableVersion === 'string'
? new ComparableVersion(comparableVersion)
: comparableVersion
return this.addToConfig({ max })
}
public min(comparableVersion: string | ComparableVersion): FluentDownload {
const min = typeof comparableVersion === 'string'
? new ComparableVersion(comparableVersion)
: comparableVersion
return this.addToConfig({ min })
}
public onFail(onFail: 'nothing' | 'increase' | 'decrease'): FluentDownload {
return this.addToConfig({ onFail })
}
public onlyNewestMajor(): FluentDownload {
return this.addToConfig({ onlyNewestMajor: true })
}
public os(os: OS): FluentDownload {
return this.addToConfig({ os })
}
public quiet(): FluentDownload {
return this.addToConfig({ quiet: true })
}
public results(results: number): FluentDownload {
return this.addToConfig({ results })
}
public store(): FluentDownload {
return this.addToConfig({ store: true })
}
public start(): Promise<DownloadReportEntry[]> {
return downloadChromium(this.config)
}
}
|