コンテンツにスキップ
Tauri

@tauri-apps/plugin-opener

このコンテンツはまだ日本語訳がありません。

Open files and URLs using their default application.

This API has a scope configuration that forces you to restrict the files and urls to be opened.

On the configuration object, open: true means that the open API can be used with any URL, as the argument is validated with the ^((mailto:\w+)|(tel:\w+)|(https?://\w+)).+ regex. You can change that regex by changing the boolean value to a string, e.g. open: ^https://github.com/.

function openPath(path, openWith?): Promise<void>

Opens a path with the system’s default app, or the one specified with openWith.

ParameterTypeDescription
pathstringThe path to open.
openWith?stringThe app to open the path with. If not specified, defaults to the system default application for the specified path type.

Promise<void>

import { openPath } from '@tauri-apps/plugin-opener';
// opens a file using the default program:
await openPath('/path/to/file');
// opens a file using `vlc` command on Windows.
await openPath('C:/path/to/file', 'vlc');

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/guest-js/index.ts#L71


function openUrl(url, openWith?): Promise<void>

Opens a url with the system’s default app, or the one specified with openWith.

ParameterTypeDescription
urlstring | URLThe URL to open.
openWith?stringThe app to open the URL with. If not specified, defaults to the system default application for the specified url type. On mobile, openWith can be provided as inAppBrowser to open the URL in an in-app browser. Otherwise, it will open the URL in the system default browser.

Promise<void>

import { openUrl } from '@tauri-apps/plugin-opener';
// opens the given URL on the default browser:
await openUrl('https://github.com/tauri-apps/tauri');
// opens the given URL using `firefox`:
await openUrl('https://github.com/tauri-apps/tauri', 'firefox');

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/guest-js/index.ts#L42


function revealItemInDir(path): Promise<unknown>

Reveal a path with the system’s default explorer.

  • Android / iOS: Unsupported.
ParameterTypeDescription
pathstringThe path to reveal.

Promise<unknown>

import { revealItemInDir } from '@tauri-apps/plugin-opener';
await revealItemInDir('/path/to/file');

2.0.0

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/opener/guest-js/index.ts#L95


© 2025 Tauri Contributors. CC-BY / MIT