Skip to content

Commit

Permalink
Readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus authored Dec 6, 2019
1 parent ed75775 commit fb905a2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

> Open stuff like URLs, files, executables. Cross-platform.
This is meant to be used in command-line tools and scripts, not in the browser.

If need this for Electron, use [`shell.openItem()`](https://electronjs.org/docs/api/shell#shellopenitemfullpath) instead.

Note: The original [`open` package](https://github.com/pwnall/node-open) was previously deprecated in favor of this package, and we got the name, so this package is now named `open` instead of `opn`. If you're upgrading from the original `open` package (`[email protected]` or lower), keep in mind that the API is different.
Expand All @@ -15,14 +17,12 @@ Note: The original [`open` package](https://github.com/pwnall/node-open) was pre
- Includes the latest [`xdg-open` script](http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c55122295c2a480fa721a9614f0e2d42b2949c18) for Linux.
- Supports WSL paths to Windows apps under `/mnt/*`.


## Install

```
$ npm install open
```


## Usage

```js
Expand All @@ -44,7 +44,6 @@ const open = require('open');
})();
```


## API

It uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
Expand All @@ -67,7 +66,7 @@ Type: `object`

##### wait

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
Expand All @@ -78,7 +77,7 @@ On Windows, you have to explicitly specify an app for it to be able to wait.

##### background <sup>(macOS only)</sup>

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Do not bring the app to the foreground.
Expand All @@ -95,15 +94,14 @@ You may also pass in the app's full path. For example on WSL, this can be `/mnt/

##### url

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Uses `encodeURI` to encode the target before executing it.<br>
We do not recommend using it on targets that are not URLs.

Especially useful when dealing with the [double-quotes on Windows](#double-quotes-on-windows) caveat.


## Caveats

### Double-quotes on Windows
Expand All @@ -129,7 +127,6 @@ The option that solved all of the problems was the second one, and for additiona

To make this caveat somewhat less impactful (at least for URLs), check out the [url option](#url). Double-quotes will be "preserved" when using it with an URL.


## Related

- [open-cli](https://github.com/sindresorhus/open-cli) - CLI for this module
Expand Down

0 comments on commit fb905a2

Please sign in to comment.