[Miscellaneous talk] Use Puppeteer-core to download Chromium to reduce the size of TypeScript projects

First use the function puppeteer-corein executablePath()to get the download path, then get the Chromiumcurrent , and then use BrowserFetcher to download.

Function

The plug-in is used here VS-Codeas a demonstration, other crawlers or Electronplatforms are similar, and the source code is here to view .
VS-CodeDirectly execute Hello Worldthe command , wait for the download completion message prompt, and Puppeteer Showthen execute the command to invoke the headless browser.
demo

Environmental requirements

  • Puppeteer-core instead of Puppeteer.

Enjoy!

Supongo que te gusta

Origin blog.csdn.net/qq_19577209/article/details/121069853
Recomendado
Clasificación