Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mbalabash/find-chrome-bin
Finds local Chromium to use it with puppeteer-core
https://github.com/mbalabash/find-chrome-bin
browser chrome chromium headless headless-chrome puppeteer-core
Last synced: 2 months ago
JSON representation
Finds local Chromium to use it with puppeteer-core
- Host: GitHub
- URL: https://github.com/mbalabash/find-chrome-bin
- Owner: mbalabash
- License: mit
- Created: 2021-11-17T15:25:16.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-25T20:29:59.000Z (10 months ago)
- Last Synced: 2024-09-29T22:53:52.060Z (3 months ago)
- Topics: browser, chrome, chromium, headless, headless-chrome, puppeteer-core
- Language: JavaScript
- Homepage:
- Size: 254 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Finds local Chromium to use it with puppeteer-core
- **Cross-platform.** Works on win, mac and linux.
- **Small.** Only 2.4 kB.
- **Zero-dependency.**
## Usage
By default, it tries to find Chromium v85+ binary with you can then use for launching puppeteer-core for your needs.
Respects `CHROMIUM_EXECUTABLE_PATH` and `PUPPETEER_EXECUTABLE_PATH` environment variables for CI purposes.
```js
import { findChrome } from 'find-chrome-bin'
const chromeInfo = await findChrome()
console.log(chromeInfo)
// { browser: "Google Chrome 96.0.4664.45", executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" }
```### Specifying `min` and/or `max` Chromium versions
You can configure a suitable version using `min` and `max` options.
```js
import { findChrome } from 'find-chrome-bin'
const chromeInfo = await findChrome({ min: 95, max: 97 })
console.log(chromeInfo)
// { browser: "Google Chrome 96.0.4664.45", executablePath: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" }
```### With fallback to download suitable Chromium revision
It can also download suitable Chromium revision as fallback (you have to provide puppeteer-core entity and Chromium revision to `download` option).
```js
import { join } from 'path'
import puppeteer from 'puppeteer-core'
import { PUPPETEER_REVISIONS } from 'puppeteer-core/lib/cjs/puppeteer/revisions.js'
import { findChrome } from 'find-chrome-bin'let chromeInfo = await findChrome({
max: 95,
download: {
puppeteer,
path: join('.', 'chrome'),
revision: PUPPETEER_REVISIONS.chromium
}
})
console.log(chromeInfo)
// { browser: "Chromium 94.0.4606.0", executablePath: "/Users/mbalabash/Projects/opensource/find-chrome-bin/example/chrome/mac-911515/chrome-mac/Chromium.app/Contents/MacOS/Chromium" }
```## Install
```js
npm i find-chrome-bin
```or
```js
yarn add find-chrome-bin
```## License
MIT