https://github.com/davidcann/node-mac-detect-browsers
Detect web browsers on macOS from Node.js or Electron via a native module
https://github.com/davidcann/node-mac-detect-browsers
browser electron electronjs macos node nodejs
Last synced: 5 months ago
JSON representation
Detect web browsers on macOS from Node.js or Electron via a native module
- Host: GitHub
- URL: https://github.com/davidcann/node-mac-detect-browsers
- Owner: davidcann
- License: mit
- Created: 2023-10-01T20:53:54.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-23T12:32:14.000Z (over 1 year ago)
- Last Synced: 2025-02-23T12:41:20.218Z (over 1 year ago)
- Topics: browser, electron, electronjs, macos, node, nodejs
- Language: Objective-C++
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-mac-detect-browsers
> Detect web browsers on macOS from Node.js or Electron via a native module
## Installing
npm install node-mac-detect-browsers
## API
**detect([callback])** (macOS only)
- `callback` Receives an `error`, if any, and an array of `results` sorted by the `name` property.
Each `result` is an object with the following properties:
- `name` string
- `path` string – absolute path to executable
- `default` bool (optional) – indicates the default application
Note: an error occurs if no browsers were found.
## Usage
In main process:
const { detect } = require("node-mac-detect-browsers");
detect((err, results) => {
if (err) {
console.error(err);
}
console.log(results);
});
or async:
(async () => {
try {
const browsers = await detect();
console.log(browsers);
} catch (err) {
console.error(err);
}
})();
Example output:
[
{
"name": "Arc",
"path": "/Applications/Arc.app"
},
{
"name": "Brave Browser",
"path": "/Applications/Brave Browser.app"
},
{
"name": "Chromium",
"path": "/Applications/Chromium.app"
},
{
"name": "Firefox",
"path": "/Applications/Firefox.app"
},
{
"name": "Google Chrome",
"path": "/Applications/Google Chrome.app"
},
{
"default": true,
"name": "Safari",
"path": "/System/Volumes/Preboot/Cryptexes/App/System/Applications/Safari.app"
},
{
"name": "Tor Browser",
"path": "/Applications/Tor Browser.app"
}
]
## License
MIT License
## Acknowledgements
- [RSWeb](https://github.com/Ranchero-Software/RSWeb), part of NetNewsWire