open is a package for opening URLs, files and executables. Inspired by open
- Really simple usage
- App arguments
- Includes
xdg-open
script
import { open } from 'https://deno.land/x/open/index.ts';
// Opens the image in the default image viewer and waits for the opened app to quit.
await open('image.png', {wait: true});
// Opens the URL in the default browser.
await open('https://google.com');
// Opens the URL in a specified browser.
await open('https://google.com', {app: 'firefox'});
// Specify app arguments.
await open('https://google.com', {app: ['google chrome', '--incognito']});
⚠ Note: on Windows, if you have search parameters in your URL, you need need to wrap the
&
char in quote marks. See #9 ⚠
It uses the command open
on macOS, start
on Windows and xdg-open
on other platforms.
Returns a promise for the spawned Deno process.
The URL, file or executable you want to open.
Waits for the spawned process to end, before resolving the Promise.
Opens the app in the background.
Specify the app you want to open the target with.
Encodes target with encodeURI
. Useful for opening URLs.
Note: on Windows, if you have search parameters in your URL, you need need to wrap the
&
char in quote marks. See #9