MCPcopy
hub / github.com/browserless/browserless / loadInstalledBinaries

Method loadInstalledBinaries

src/browserless.ts:208–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

206 }
207
208 protected async loadInstalledBinaries(): Promise<void> {
209 const pwVersions = this.config.getPwVersions();
210 const browserTypes = ['chromium', 'firefox', 'webkit'] as const;
211
212 await Promise.all(
213 browserTypes.map(async (browserType) => {
214 const installed: Array<[number, string, string]> = [];
215
216 await Promise.all(
217 Object.keys(pwVersions).map(async (version) => {
218 const minor = parseFloat(version);
219 if (isNaN(minor)) return;
220
221 try {
222 const pw = await this.config.loadPwVersion(version);
223 const exePath = pw[browserType].executablePath();
224 if (await exists(exePath)) {
225 installed.push([minor, version, exePath]);
226 }
227 } catch {
228 // Package not installed, skip
229 }
230 }),
231 );
232
233 installed.sort(([a], [b]) => a - b);
234 this.config.setInstalledBinaries(browserType, installed);
235 }),
236 );
237 }
238
239 protected async saveMetrics(): Promise<void> {
240 const metricsPath = this.config.getMetricsJSONPath();

Callers 1

startMethod · 0.95

Calls 4

existsFunction · 0.85
getPwVersionsMethod · 0.80
loadPwVersionMethod · 0.80
setInstalledBinariesMethod · 0.80

Tested by

no test coverage detected