zen-location
v1.0.0
Published
Approximates the current location of the Zen Browser across platforms.
Maintainers
Readme
Approximates the current location of the Zen Browser across platforms.
zen-location

- By default checks only
stable. - Supports macOS / Windows / Linux
- Works both as an ES module or CommonJS
Installation
npm i zen-locationSupport table
This table lists the default locations where Zen Browser is typically installed for each supported platform and channel. By default, only the Stable channel is checked.
Returns the first existing path found (given selected channels), or null if none are found.
Usage
Via Node.js (strict by default):
import zenLocation from 'zen-location'
import {
locateZenOrExplain,
getInstallGuidance,
getZenVersion
} from 'zen-location'
// Strict (Stable only)
console.log(zenLocation())
// => "/Applications/Zen Browser.app/Contents/MacOS/Zen Browser" or null
// Throw with an install guide when not found
try {
const bin = locateZenOrExplain({allowFallback: true})
console.log(bin)
// Cross-platform version (no exec by default)
console.log(getZenVersion(bin)) // e.g. "128.0" or null
// Opt-in: allow executing the binary (Linux/other)
console.log(getZenVersion(bin, {allowExec: true}))
} catch (e) {
console.error(String(e))
// Or print getInstallGuidance() explicitly
}CommonJS:
const api = require('zen-location')
const locateZen = api.default || apiVia CLI:
npx zen-location
# Respect environment overrides
ZEN_BINARY=/custom/path/to/zen npx zen-location
# Print browser version (empty + exit code 2 if unavailable)
npx zen-location --zen-version
npx zen-location --browser-version
# Opt-in: allow executing the binary to fetch version
npx zen-location --browser-version --allow-execEnvironment overrides
If this environment variable is set and points to an existing binary, it takes precedence:
ZEN_BINARY
API
default export locateZen(allowFallback?: boolean): string | nulllocateZenOrExplain(options?: boolean | { allowFallback?: boolean }): stringgetZenVersion(bin: string, opts?: { allowExec?: boolean }): string | nullgetInstallGuidance(): string
Related projects
- brave-location
- chrome-location2
- chromium-location
- edge-location
- firefox-location2
- safari-location2
- opera-location2
- vivaldi-location2
- waterfox-location
- yandex-location
License
MIT (c) Cezar Augusto.
