diff --git a/readme.md b/readme.md index 2937dab..3af7f35 100644 --- a/readme.md +++ b/readme.md @@ -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 (`open@0.0.5` or lower), keep in mind that the API is different. @@ -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 @@ -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. @@ -67,7 +66,7 @@ Type: `object` ##### wait -Type: `boolean`
+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. @@ -78,7 +77,7 @@ On Windows, you have to explicitly specify an app for it to be able to wait. ##### background (macOS only) -Type: `boolean`
+Type: `boolean`\ Default: `false` Do not bring the app to the foreground. @@ -95,7 +94,7 @@ You may also pass in the app's full path. For example on WSL, this can be `/mnt/ ##### url -Type: `boolean`
+Type: `boolean`\ Default: `false` Uses `encodeURI` to encode the target before executing it.
@@ -103,7 +102,6 @@ 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 @@ -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