Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

default-browser

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

default-browser - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

license

29

index.js
'use strict';
var defaultBrowserId = require('default-browser-id');
var bundleName = require('bundle-name');
const defaultBrowserId = require('default-browser-id');
const bundleName = require('bundle-name');
module.exports = function (cb) {
defaultBrowserId(function (err, id) {
if (err) {
cb(err);
return;
}
module.exports = () => {
if (process.platform === 'linux') {
return require('xdg-default-browser')();
}
bundleName(id, function (err, name) {
if (err) {
cb(err);
return;
}
if (process.platform !== 'darwin') {
throw new Error('Only OS X and Linux are supported');
}
cb(null, {
name: name,
id: id
});
});
});
return defaultBrowserId().then(id => bundleName(id).then(name => ({name, id})));
};
{
"name": "default-browser",
"version": "1.0.0",
"description": "Get the default browser (OS X)",
"version": "2.0.0",
"description": "Get the default browser",
"license": "MIT",

@@ -10,23 +10,16 @@ "repository": "sindresorhus/default-browser",

"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"bin": {
"default-browser": "cli.js"
},
"engines": {
"node": ">=0.10.0"
"node": ">=4"
},
"os": [
"darwin"
],
"scripts": {
"test": "mocha"
"test": "xo && ava"
},
"files": [
"index.js",
"cli.js"
"index.js"
],
"keywords": [
"osx",
"mac",
"linux",
"browser",

@@ -42,13 +35,16 @@ "default",

"CFBundleName",
"cli",
"bin",
"applescript"
],
"dependencies": {
"bundle-name": "^1.0.0",
"default-browser-id": "^1.0.0"
"bundle-name": "^2.0.1",
"default-browser-id": "^2.0.0",
"xdg-default-browser": "^2.0.0"
},
"devDependencies": {
"mocha": "*"
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
}
# default-browser [![Build Status](https://travis-ci.org/sindresorhus/default-browser.svg?branch=master)](https://travis-ci.org/sindresorhus/default-browser)
> Get the default browser (OS X)
> Get the default browser (OS X and Linux)

@@ -8,3 +8,3 @@

```bash
```
$ npm install --save default-browser

@@ -17,7 +17,7 @@ ```

```js
var defaultBrowser = require('default-browser');
const defaultBrowser = require('default-browser');
defaultBrowser(function (err, browser) {
defaultBrowser().then(browser => {
console.log(browser);
//=> { name: 'Safari', id: 'com.apple.Safari' }
//=> {name: 'Safari', id: 'com.apple.Safari'}
});

@@ -27,21 +27,9 @@ ```

## CLI
## Related
You can also use it as a CLI app by installing it globally:
- [default-browser-cli](https://github.com/sindresorhus/default-browser-cli) - CLI for this module
```bash
$ npm install --global default-browser
```
### Usage
```bash
$ default-browser
```
Which will for example output `Safari`.
## License
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc