Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 3.1KB

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # open
  2. > Open stuff like URLs, files, executables. Cross-platform.
  3. If need this for Electron, use [`shell.openItem()`](https://electronjs.org/docs/api/shell#shellopenitemfullpath) instead.
  4. Note: The original [`open` package](https://github.com/pwnall/node-open) was recently 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.
  5. #### Why?
  6. - Actively maintained.
  7. - Supports app arguments.
  8. - Safer as it uses `spawn` instead of `exec`.
  9. - Fixes most of the open original `node-open` issues.
  10. - Includes the latest [`xdg-open` script](http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=c55122295c2a480fa721a9614f0e2d42b2949c18) for Linux.
  11. - Supports WSL paths to Windows apps under `/mnt/*`.
  12. ## Install
  13. ```
  14. $ npm install open
  15. ```
  16. ## Usage
  17. ```js
  18. const open = require('open');
  19. // Opens the image in the default image viewer
  20. (async () => {
  21. await open('unicorn.png', {wait: true});
  22. console.log('The image viewer app closed');
  23. // Opens the url in the default browser
  24. await open('https://sindresorhus.com');
  25. // Specify the app to open in
  26. await open('https://sindresorhus.com', {app: 'firefox'});
  27. // Specify app arguments
  28. await open('https://sindresorhus.com', {app: ['google chrome', '--incognito']});
  29. })();
  30. ```
  31. ## API
  32. It uses the command `open` on macOS, `start` on Windows and `xdg-open` on other platforms.
  33. ### open(target, [options])
  34. Returns a promise for the [spawned child process](https://nodejs.org/api/child_process.html#child_process_class_childprocess). You would normally not need to use this for anything, but it can be useful if you'd like to attach custom event listeners or perform other operations directly on the spawned process.
  35. #### target
  36. Type: `string`
  37. The thing you want to open. Can be a URL, file, or executable.
  38. Opens in the default app for the file type. For example, URLs opens in your default browser.
  39. #### options
  40. Type: `Object`
  41. ##### wait
  42. Type: `boolean`<br>
  43. Default: `false`
  44. Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
  45. Note that it waits for the app to exit, not just for the window to close.
  46. On Windows, you have to explicitly specify an app for it to be able to wait.
  47. ##### app
  48. Type: `string | string[]`
  49. Specify the app to open the `target` with, or an array with the app and app arguments.
  50. The app name is platform dependent. Don't hard code it in reusable modules. For example, Chrome is `google chrome` on macOS, `google-chrome` on Linux and `chrome` on Windows.
  51. You may also pass in the app's full path. For example on WSL, this can be `/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe` for the Windows installation of Chrome.
  52. ## Related
  53. - [opn-cli](https://github.com/sindresorhus/opn-cli) - CLI for this module
  54. - [open-editor](https://github.com/sindresorhus/open-editor) - Open files in your editor at a specific line and column
  55. ## License
  56. MIT © [Sindre Sorhus](https://sindresorhus.com)