Skip to content

@tauri-apps/api/path

The path module provides utilities for working with file and directory paths.

This package is also accessible with window.__TAURI__.path when app.withGlobalTauri in tauri.conf.json is set to true.

It is recommended to allowlist only the APIs you use for optimal bundle size and security.

function appCacheDir(): Promise<string>;

Defined in: packages/api/src/path.ts:176

Returns the path to the suggested directory for your app’s cache files. Resolves to ${cacheDir}/${bundleIdentifier}, where bundleIdentifier is the identifier value configured in tauri.conf.json.

import { appCacheDir } from '@tauri-apps/api/path';
const appCacheDirPath = await appCacheDir();

Promise<string>

1.2.0


function appConfigDir(): Promise<string>;

Defined in: packages/api/src/path.ts:125

Returns the path to the suggested directory for your app’s config files. Resolves to ${configDir}/${bundleIdentifier}, where bundleIdentifier is the identifier value configured in tauri.conf.json.

import { appConfigDir } from '@tauri-apps/api/path';
const appConfigDirPath = await appConfigDir();

Promise<string>

1.2.0


function appDataDir(): Promise<string>;

Defined in: packages/api/src/path.ts:142

Returns the path to the suggested directory for your app’s data files. Resolves to ${dataDir}/${bundleIdentifier}, where bundleIdentifier is the identifier value configured in tauri.conf.json.

import { appDataDir } from '@tauri-apps/api/path';
const appDataDirPath = await appDataDir();

Promise<string>

1.2.0


function appLocalDataDir(): Promise<string>;

Defined in: packages/api/src/path.ts:159

Returns the path to the suggested directory for your app’s local data files. Resolves to ${localDataDir}/${bundleIdentifier}, where bundleIdentifier is the identifier value configured in tauri.conf.json.

import { appLocalDataDir } from '@tauri-apps/api/path';
const appLocalDataDirPath = await appLocalDataDir();

Promise<string>

1.2.0


function appLogDir(): Promise<string>;

Defined in: packages/api/src/path.ts:604

Returns the path to the suggested directory for your app’s log files.

Platform-specific

  • Linux: Resolves to ${configDir}/${bundleIdentifier}/logs.
  • macOS: Resolves to ${homeDir}/Library/Logs/{bundleIdentifier}
  • Windows: Resolves to ${configDir}/${bundleIdentifier}/logs.
import { appLogDir } from '@tauri-apps/api/path';
const appLogDirPath = await appLogDir();

Promise<string>

1.2.0


function audioDir(): Promise<string>;

Defined in: packages/api/src/path.ts:198

Returns the path to the user’s audio directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_MUSIC_DIR.
  • macOS: Resolves to $HOME/Music.
  • Windows: Resolves to {FOLDERID_Music}.
import { audioDir } from '@tauri-apps/api/path';
const audioDirPath = await audioDir();

Promise<string>

1.0.0


function basename(path: string, ext?: string): Promise<string>;

Defined in: packages/api/src/path.ts:734

Returns the last portion of a path. Trailing directory separators are ignored.

import { basename } from '@tauri-apps/api/path';
const base = await basename('path/to/app.conf');
assert(base === 'app.conf');
Parameter Type Description
path string -
ext? string An optional file extension to be removed from the returned path.

Promise<string>

1.0.0


function cacheDir(): Promise<string>;

Defined in: packages/api/src/path.ts:220

Returns the path to the user’s cache directory.

Platform-specific

  • Linux: Resolves to $XDG_CACHE_HOME or $HOME/.cache.
  • macOS: Resolves to $HOME/Library/Caches.
  • Windows: Resolves to {FOLDERID_LocalAppData}.
import { cacheDir } from '@tauri-apps/api/path';
const cacheDirPath = await cacheDir();

Promise<string>

1.0.0


function configDir(): Promise<string>;

Defined in: packages/api/src/path.ts:242

Returns the path to the user’s config directory.

Platform-specific

  • Linux: Resolves to $XDG_CONFIG_HOME or $HOME/.config.
  • macOS: Resolves to $HOME/Library/Application Support.
  • Windows: Resolves to {FOLDERID_RoamingAppData}.
import { configDir } from '@tauri-apps/api/path';
const configDirPath = await configDir();

Promise<string>

1.0.0


function dataDir(): Promise<string>;

Defined in: packages/api/src/path.ts:264

Returns the path to the user’s data directory.

Platform-specific

  • Linux: Resolves to $XDG_DATA_HOME or $HOME/.local/share.
  • macOS: Resolves to $HOME/Library/Application Support.
  • Windows: Resolves to {FOLDERID_RoamingAppData}.
import { dataDir } from '@tauri-apps/api/path';
const dataDirPath = await dataDir();

Promise<string>

1.0.0


function delimiter(): string;

Defined in: packages/api/src/path.ts:644

Returns the platform-specific path segment delimiter:

  • ; on Windows
  • : on POSIX

string

2.0.0


function desktopDir(): Promise<string>;

Defined in: packages/api/src/path.ts:286

Returns the path to the user’s desktop directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_DESKTOP_DIR.
  • macOS: Resolves to $HOME/Desktop.
  • Windows: Resolves to {FOLDERID_Desktop}.
import { desktopDir } from '@tauri-apps/api/path';
const desktopPath = await desktopDir();

Promise<string>

1.0.0


function dirname(path: string): Promise<string>;

Defined in: packages/api/src/path.ts:703

Returns the parent directory of a given path. Trailing directory separators are ignored.

import { dirname } from '@tauri-apps/api/path';
const dir = await dirname('/path/to/somedir/');
assert(dir === '/path/to');
Parameter Type
path string

Promise<string>

1.0.0


function documentDir(): Promise<string>;

Defined in: packages/api/src/path.ts:308

Returns the path to the user’s document directory.

import { documentDir } from '@tauri-apps/api/path';
const documentDirPath = await documentDir();

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_DOCUMENTS_DIR.
  • macOS: Resolves to $HOME/Documents.
  • Windows: Resolves to {FOLDERID_Documents}.

Promise<string>

1.0.0


function downloadDir(): Promise<string>;

Defined in: packages/api/src/path.ts:330

Returns the path to the user’s download directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_DOWNLOAD_DIR.
  • macOS: Resolves to $HOME/Downloads.
  • Windows: Resolves to {FOLDERID_Downloads}.
import { downloadDir } from '@tauri-apps/api/path';
const downloadDirPath = await downloadDir();

Promise<string>

1.0.0


function executableDir(): Promise<string>;

Defined in: packages/api/src/path.ts:352

Returns the path to the user’s executable directory.

Platform-specific

  • Linux: Resolves to $XDG_BIN_HOME/../bin or $XDG_DATA_HOME/../bin or $HOME/.local/bin.
  • macOS: Not supported.
  • Windows: Not supported.
import { executableDir } from '@tauri-apps/api/path';
const executableDirPath = await executableDir();

Promise<string>

1.0.0


function extname(path: string): Promise<string>;

Defined in: packages/api/src/path.ts:718

Returns the extension of the path.

import { extname } from '@tauri-apps/api/path';
const ext = await extname('/path/to/file.html');
assert(ext === 'html');
Parameter Type
path string

Promise<string>

1.0.0


function fontDir(): Promise<string>;

Defined in: packages/api/src/path.ts:374

Returns the path to the user’s font directory.

Platform-specific

  • Linux: Resolves to $XDG_DATA_HOME/fonts or $HOME/.local/share/fonts.
  • macOS: Resolves to $HOME/Library/Fonts.
  • Windows: Not supported.
import { fontDir } from '@tauri-apps/api/path';
const fontDirPath = await fontDir();

Promise<string>

1.0.0


function homeDir(): Promise<string>;

Defined in: packages/api/src/path.ts:396

Returns the path to the user’s home directory.

Platform-specific

  • Linux: Resolves to $HOME.
  • macOS: Resolves to $HOME.
  • Windows: Resolves to {FOLDERID_Profile}.
import { homeDir } from '@tauri-apps/api/path';
const homeDirPath = await homeDir();

Promise<string>

1.0.0


function isAbsolute(path: string): Promise<boolean>;

Defined in: packages/api/src/path.ts:748

Returns whether the path is absolute or not.

import { isAbsolute } from '@tauri-apps/api/path';
assert(await isAbsolute('/home/tauri'));
Parameter Type
path string

Promise<boolean>

1.0.0


function join(...paths: string[]): Promise<string>;

Defined in: packages/api/src/path.ts:688

Joins all given path segments together using the platform-specific separator as a delimiter, then normalizes the resulting path.

import { join, appDataDir } from '@tauri-apps/api/path';
const appDataDirPath = await appDataDir();
const path = await join(appDataDirPath, 'users', 'tauri', 'avatar.png');
Parameter Type
paths string[]

Promise<string>

1.0.0


function localDataDir(): Promise<string>;

Defined in: packages/api/src/path.ts:418

Returns the path to the user’s local data directory.

Platform-specific

  • Linux: Resolves to $XDG_DATA_HOME or $HOME/.local/share.
  • macOS: Resolves to $HOME/Library/Application Support.
  • Windows: Resolves to {FOLDERID_LocalAppData}.
import { localDataDir } from '@tauri-apps/api/path';
const localDataDirPath = await localDataDir();

Promise<string>

1.0.0


function normalize(path: string): Promise<string>;

Defined in: packages/api/src/path.ts:673

Normalizes the given path, resolving '..' and '.' segments and resolve symbolic links.

import { normalize, appDataDir } from '@tauri-apps/api/path';
const appDataDirPath = await appDataDir();
const path = await normalize(`${appDataDirPath}/../users/tauri/avatar.png`);
Parameter Type
path string

Promise<string>

1.0.0


function pictureDir(): Promise<string>;

Defined in: packages/api/src/path.ts:440

Returns the path to the user’s picture directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_PICTURES_DIR.
  • macOS: Resolves to $HOME/Pictures.
  • Windows: Resolves to {FOLDERID_Pictures}.
import { pictureDir } from '@tauri-apps/api/path';
const pictureDirPath = await pictureDir();

Promise<string>

1.0.0


function publicDir(): Promise<string>;

Defined in: packages/api/src/path.ts:462

Returns the path to the user’s public directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_PUBLICSHARE_DIR.
  • macOS: Resolves to $HOME/Public.
  • Windows: Resolves to {FOLDERID_Public}.
import { publicDir } from '@tauri-apps/api/path';
const publicDirPath = await publicDir();

Promise<string>

1.0.0


function resolve(...paths: string[]): Promise<string>;

Defined in: packages/api/src/path.ts:658

Resolves a sequence of paths or path segments into an absolute path.

import { resolve, appDataDir } from '@tauri-apps/api/path';
const appDataDirPath = await appDataDir();
const path = await resolve(appDataDirPath, '..', 'users', 'tauri', 'avatar.png');
Parameter Type
paths string[]

Promise<string>

1.0.0


function resolveResource(resourcePath: string): Promise<string>;

Defined in: packages/api/src/path.ts:515

Resolve the path to a resource file.

import { resolveResource } from '@tauri-apps/api/path';
const resourcePath = await resolveResource('script.sh');
Parameter Type Description
resourcePath string The path to the resource. Must follow the same syntax as defined in tauri.conf.json > bundle > resources, i.e. keeping subfolders and parent dir components (../).

Promise<string>

The full path to the resource.

1.0.0


function resourceDir(): Promise<string>;

Defined in: packages/api/src/path.ts:495

Returns the path to the application’s resource directory. To resolve a resource path, see resolveResource.

Platform-specific

Although we provide the exact path where this function resolves to, this is not a contract and things might change in the future

  • Windows: Resolves to the directory that contains the main executable.
  • Linux: When running in an AppImage, the APPDIR variable will be set to the mounted location of the app, and the resource dir will be ${APPDIR}/usr/lib/${exe_name}. If not running in an AppImage, the path is /usr/lib/${exe_name}. When running the app from src-tauri/target/(debug|release)/, the path is ${exe_dir}/../lib/${exe_name}.
  • macOS: Resolves to ${exe_dir}/../Resources (inside .app).
  • iOS: Resolves to ${exe_dir}/assets.
  • Android: Currently the resources are stored in the APK as assets so it’s not a normal file system path, we return a special URI prefix asset://localhost/ here that can be used with the file system plugin,
import { resourceDir } from '@tauri-apps/api/path';
const resourceDirPath = await resourceDir();

Promise<string>

1.0.0


function runtimeDir(): Promise<string>;

Defined in: packages/api/src/path.ts:538

Returns the path to the user’s runtime directory.

Platform-specific

  • Linux: Resolves to $XDG_RUNTIME_DIR.
  • macOS: Not supported.
  • Windows: Not supported.
import { runtimeDir } from '@tauri-apps/api/path';
const runtimeDirPath = await runtimeDir();

Promise<string>

1.0.0


function sep(): string;

Defined in: packages/api/src/path.ts:633

Returns the platform-specific path segment separator:

  • \ on Windows
  • / on POSIX

string

2.0.0


function tempDir(): Promise<string>;

Defined in: packages/api/src/path.ts:620

Returns a temporary directory.

import { tempDir } from '@tauri-apps/api/path';
const temp = await tempDir();

Promise<string>

2.0.0


function templateDir(): Promise<string>;

Defined in: packages/api/src/path.ts:560

Returns the path to the user’s template directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_TEMPLATES_DIR.
  • macOS: Not supported.
  • Windows: Resolves to {FOLDERID_Templates}.
import { templateDir } from '@tauri-apps/api/path';
const templateDirPath = await templateDir();

Promise<string>

1.0.0


function videoDir(): Promise<string>;

Defined in: packages/api/src/path.ts:582

Returns the path to the user’s video directory.

Platform-specific

  • Linux: Resolves to xdg-user-dirsXDG_VIDEOS_DIR.
  • macOS: Resolves to $HOME/Movies.
  • Windows: Resolves to {FOLDERID_Videos}.
import { videoDir } from '@tauri-apps/api/path';
const videoDirPath = await videoDir();

Promise<string>

1.0.0

Defined in: packages/api/src/path.ts:19

2.0.0

Enumeration Member Value Description Defined in
AppCache 16 See appCacheDir for more information. packages/api/src/path.ts:83
AppConfig 13 See appConfigDir for more information. packages/api/src/path.ts:71
AppData 14 See appDataDir for more information. packages/api/src/path.ts:75
AppLocalData 15 See appLocalDataDir for more information. packages/api/src/path.ts:79
AppLog 17 See appLogDir for more information. packages/api/src/path.ts:87
Audio 1 See audioDir for more information. packages/api/src/path.ts:23
Cache 2 See cacheDir for more information. packages/api/src/path.ts:27
Config 3 See configDir for more information. packages/api/src/path.ts:31
Data 4 See dataDir for more information. packages/api/src/path.ts:35
Desktop 18 See desktopDir for more information. packages/api/src/path.ts:91
Document 6 See documentDir for more information. packages/api/src/path.ts:43
Download 7 See downloadDir for more information. packages/api/src/path.ts:47
Executable 19 See executableDir for more information. packages/api/src/path.ts:95
Font 20 See fontDir for more information. packages/api/src/path.ts:99
Home 21 See homeDir for more information. packages/api/src/path.ts:103
LocalData 5 See localDataDir for more information. packages/api/src/path.ts:39
Picture 8 See pictureDir for more information. packages/api/src/path.ts:51
Public 9 See publicDir for more information. packages/api/src/path.ts:55
Resource 11 See resourceDir for more information. packages/api/src/path.ts:63
Runtime 22 See runtimeDir for more information. packages/api/src/path.ts:107
Temp 12 See tempDir for more information. packages/api/src/path.ts:67
Template 23 See templateDir for more information. packages/api/src/path.ts:111
Video 10 See videoDir for more information. packages/api/src/path.ts:59

© 2026 Tauri Contributors. CC-BY / MIT