Approximates the current location of the Opera browser across platforms.
npm install opera-location2[npm-version-image]: https://img.shields.io/npm/v/opera-location2.svg?color=ff0000
[npm-version-url]: https://www.npmjs.com/package/opera-location2
[npm-downloads-image]: https://img.shields.io/npm/dm/opera-location2.svg?color=2ecc40
[npm-downloads-url]: https://www.npmjs.com/package/opera-location2
[action-image]: https://github.com/cezaraugusto/opera-location2/actions/workflows/ci.yml/badge.svg?branch=main
[action-url]: https://github.com/cezaraugusto/opera-location2/actions
> Approximates the current location of the Opera browser across platforms.
* By default checks only stable. Optionally can cascade to beta / developer.
* Supports macOS / Windows / Linux
* Works both as an ES module or CommonJS
This table lists the default locations where Opera is typically installed for each supported platform and channel. By default, only the Stable channel is checked. When fallback is enabled, the package checks these paths (in order) and returns the first one found.
| Platform | Channel | Paths checked |
|---|---|---|
![]() macOS | Opera (Stable) |
|
| Opera Beta |
| |
| Opera Developer |
| |
![]() Windows | Opera (Stable) |
|
| Opera Beta |
| |
| Opera Developer |
| |
![]() Linux/other | Opera (Stable) |
|
| Opera Beta |
| |
| Opera Developer |
|
Returns the first existing path found (given selected channels), or null if none are found.
Via Node.js (strict by default):
``js
import operaLocation from "opera-location2";
import {
locateOperaOrExplain,
getInstallGuidance,
getOperaVersion
} from "opera-location2";
// Strict (Stable only)
console.log(operaLocation());
// => "/Applications/Opera.app/Contents/MacOS/Opera" or null
// Enable fallback (Stable / Beta / Developer)
console.log(operaLocation(true));
// => first found among Stable/Beta/Developer or null
// Throw with a friendly guide when not found
try {
const bin = locateOperaOrExplain({allowFallback: true});
console.log(bin);
// Cross-platform version (no exec by default)
console.log(getOperaVersion(bin)); // e.g. "114.0.5282.233" or null
// Opt-in: allow executing the binary (Linux/other)
console.log(getOperaVersion(bin, {allowExec: true}));
} catch (e) {
console.error(String(e));
// Or print getInstallGuidance() explicitly
}
`
Via CLI:
`bash
npx opera-location2Strict (Stable only)
npx opera-location2 --fallback
$3
If this environment variable is set and points to an existing binary, it takes precedence:
-
OPERA_BINARYAPI
-
default export locateOpera(allowFallback?: boolean): string | null
- locateOperaOrExplain(options?: boolean | { allowFallback?: boolean }): string
- getOperaVersion(bin: string, opts?: { allowExec?: boolean }): string | null
- getInstallGuidance(): string`* brave-location
* chrome-location2
* edge-location
* firefox-location2
* vivaldi-location2
* yandex-location
* librewolf-location
* waterfox-location
MIT (c) Cezar Augusto.