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

default-browser

Package Overview
Dependencies
Maintainers
1
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 2.0.1 to 3.0.0

index.d.ts

20

index.js

@@ -1,6 +0,6 @@

'use strict';
const defaultBrowserId = require('default-browser-id');
const bundleName = require('bundle-name');
import defaultBrowserId from 'default-browser-id';
import bundleName from 'bundle-name';
import windows from './windows.js';
module.exports = () => {
export default async function defaultBrowser() {
if (process.platform === 'linux') {

@@ -11,6 +11,12 @@ return require('xdg-default-browser')();

if (process.platform === 'darwin') {
return defaultBrowserId().then(id => bundleName(id).then(name => ({name, id})));
const id = await defaultBrowserId();
const name = await bundleName(id);
return {name, id};
}
return Promise.reject(new Error('Only macOS and Linux are supported'));
};
if (process.platform === 'win32') {
return windows();
}
throw new Error('Only macOS, Linux, and Windows are supported');
}
{
"name": "default-browser",
"version": "2.0.1",
"description": "Get the default browser",
"license": "MIT",
"repository": "sindresorhus/default-browser",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"macos",
"osx",
"linux",
"browser",
"default",
"plist",
"web",
"bundle",
"bundleid",
"id",
"identifier",
"uti",
"CFBundleName",
"applescript"
],
"dependencies": {
"bundle-name": "^2.0.1",
"default-browser-id": "^2.0.0",
"xdg-default-browser": "^2.0.0"
},
"devDependencies": {
"ava": "*",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "default-browser",
"version": "3.0.0",
"description": "Get the default browser",
"license": "MIT",
"repository": "sindresorhus/default-browser",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=12"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"windows.js",
"index.d.ts"
],
"keywords": [
"macos",
"linux",
"browser",
"default",
"plist",
"web",
"bundle",
"bundleid",
"id",
"identifier",
"uti",
"cfbundlename",
"applescript"
],
"dependencies": {
"bundle-name": "^3.0.0",
"default-browser-id": "^3.0.0",
"execa": "^5.0.0",
"xdg-default-browser": "^2.1.0"
},
"devDependencies": {
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}

@@ -1,5 +0,6 @@

# default-browser [![Build Status](https://travis-ci.org/sindresorhus/default-browser.svg?branch=master)](https://travis-ci.org/sindresorhus/default-browser)
# default-browser
> Get the default browser (macOS and Linux)
> Get the default browser
Works on macOS, Linux, and Windows.

@@ -9,25 +10,16 @@ ## Install

```
$ npm install --save default-browser
$ npm install default-browser
```
## Usage
```js
const defaultBrowser = require('default-browser');
import defaultBrowser from 'default-browser';
defaultBrowser().then(browser => {
console.log(browser);
//=> {name: 'Safari', id: 'com.apple.Safari'}
});
console.log(await defaultBrowser());
//=> {name: 'Safari', id: 'com.apple.Safari'}
```
## Related
- [default-browser-cli](https://github.com/sindresorhus/default-browser-cli) - CLI for this module
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
- [default-browser-cli](https://github.com/sindresorhus/default-browser-cli) - CLI for this package

Sorry, the diff of this file is not supported yet

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