JSPM

chrome-paths

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6086
  • Score
    100M100P100Q121377F
  • License ISC

Possible paths or binary names of Chrome, Chrome Canary and Chromium in the current platform

Package Exports

  • chrome-paths

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (chrome-paths) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

chrome-paths

npm version Build Status

Possible paths or binary names of Chrome, Chrome Canary and Chromium in the current platform

const chromePaths = require('chrome-paths');

// On macOS

chromePaths.chrome; //=> '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
chromePaths.chromeCanary; //=> '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'
chromePaths.chromium; //=> '/Applications/Chromium.app/Contents/MacOS/Chromium'

// On Linux

chromePaths.chrome; //=> 'google-chrome'
chromePaths.chromeCanary; //=> null
chromePaths.chromium; //=> 'chromium'

// On Windows

chromePaths.chrome; //=> 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
chromePaths.chromeCanary; //=> 'C:\\Program Files (x86)\\Google\\Chrome SxS\\Application\\chrome.exe'
chromePaths.chromium //=> 'C:\\Program Files (x86)\\Chromium\\Application\\chrome.exe'

// On Solaris

chromePaths.chrome; //=> null
chromePaths.chromeCanary; //=> null
chromePaths.chromium; //=> null

Installation

Use npm.

npm install chrome-paths

API

const chromePaths = require('chrome-paths');

chromePaths.chrome, chromePaths.chromeCanary, chromePaths.chromium

Type: string or null

const {execFile} = require('child_process');
const {promisify} = require('util');
const {chrome, chromeCanary} = require('chrome-paths');

(async () => {
  (await promisify(execFile)(chrome, ['--version'])).stdout; //=> 'Google Chrome 71.0.3578.98 \n'
  (await promisify(execFile)(chromeCanary, ['--version'])).stdout; //=> 'Google Chrome 74.0.3689.0 canary\n'
})();

Whether each property is a full path, just a binary name or null depends on the current platform.

License

ISC License © 2018 - 2019 Shinnosuke Watanabe