Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.d.ts 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /// <reference types="node"/>
  2. import {ChildProcess} from 'child_process';
  3. declare namespace open {
  4. interface Options {
  5. /**
  6. Wait for the opened app to exit before fulfilling the promise. If `false` it's fulfilled immediately when opening the app.
  7. Note that it waits for the app to exit, not just for the window to close.
  8. On Windows, you have to explicitly specify an app for it to be able to wait.
  9. @default false
  10. */
  11. readonly wait?: boolean;
  12. /**
  13. __macOS only__
  14. Do not bring the app to the foreground.
  15. @default false
  16. */
  17. readonly background?: boolean;
  18. /**
  19. Specify the app to open the `target` with, or an array with the app and app arguments.
  20. 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.
  21. 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.
  22. */
  23. readonly app?: string | readonly string[];
  24. /**
  25. __deprecated__
  26. This option will be removed in the next major release.
  27. */
  28. readonly url?: boolean;
  29. /**
  30. Allow the opened app to exit with nonzero exit code when the `wait` option is `true`.
  31. We do not recommend setting this option. The convention for success is exit code zero.
  32. @default false
  33. */
  34. readonly allowNonzeroExitCode?: boolean;
  35. }
  36. }
  37. /**
  38. Open stuff like URLs, files, executables. Cross-platform.
  39. Uses the command `open` on OS X, `start` on Windows and `xdg-open` on other platforms.
  40. There is a caveat for [double-quotes on Windows](https://github.com/sindresorhus/open#double-quotes-on-windows) where all double-quotes are stripped from the `target`.
  41. @param target - The thing you want to open. Can be a URL, file, or executable. Opens in the default app for the file type. For example, URLs open in your default browser.
  42. @returns 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.
  43. @example
  44. ```
  45. import open = require('open');
  46. // Opens the image in the default image viewer
  47. (async () => {
  48. await open('unicorn.png', {wait: true});
  49. console.log('The image viewer app closed');
  50. // Opens the url in the default browser
  51. await open('https://sindresorhus.com');
  52. // Specify the app to open in
  53. await open('https://sindresorhus.com', {app: 'firefox'});
  54. // Specify app arguments
  55. await open('https://sindresorhus.com', {app: ['google chrome', '--incognito']});
  56. })();
  57. ```
  58. */
  59. declare function open(
  60. target: string,
  61. options?: open.Options
  62. ): Promise<ChildProcess>;
  63. export = open;