tauri-app-file-system

$npx mdskill add partme-ai/full-stack-skills/tauri-app-file-system

Enables reading and writing local files in Tauri v2 apps with scoped directory access for secure file operations.

  • Helps implement file read/write operations and import/export workflows in desktop applications.
  • Integrates with the Tauri file-system plugin and requires configuration in Tauri builder and capabilities.
  • Triggers based on user mentions of file system tasks, scope configuration, or specific phrases like 'read file'.
  • Provides results through frontend TypeScript functions for reading and writing files with directory options.
SKILL.md
.github/skills/tauri-app-file-systemView on GitHub ↗
---
name: tauri-app-file-system
description: "Read and write local files using the Tauri v2 file-system plugin with scoped directory access. Use when implementing file read/write operations, configuring safe directory scopes, or building import/export file workflows."
license: Complete terms in LICENSE.txt
---


## When to use this skill

**ALWAYS use this skill when the user mentions:**
- Reading or writing local files in a Tauri app
- Configuring file system scope for safe access
- File import/export workflows

**Trigger phrases include:**
- "file system", "read file", "write file", "fs plugin", "file access", "scope"

## How to use this skill

1. **Install the file-system plugin**:
   ```bash
   cargo add tauri-plugin-fs
   ```
2. **Register the plugin** in your Tauri builder:
   ```rust
   tauri::Builder::default()
       .plugin(tauri_plugin_fs::init())
   ```
3. **Configure scoped access** in `src-tauri/capabilities/default.json`:
   ```json
   {
     "permissions": [
       { "identifier": "fs:allow-read-text-file", "allow": [{ "path": "$APPDATA/**" }] },
       { "identifier": "fs:allow-write-text-file", "allow": [{ "path": "$APPDATA/**" }] }
     ]
   }
   ```
4. **Read and write files from the frontend**:
   ```typescript
   import { readTextFile, writeTextFile, BaseDirectory } from '@tauri-apps/plugin-fs';
   const content = await readTextFile('config.json', { baseDir: BaseDirectory.AppData });
   await writeTextFile('config.json', JSON.stringify(data), { baseDir: BaseDirectory.AppData });
   ```
5. **Define minimal directory scopes** to restrict access to only the directories your app needs
6. **Validate access boundaries** and handle permission errors gracefully

## Outputs

- File system plugin setup with scoped directory access
- Read/write operations using BaseDirectory constants
- Minimal-scope permission configuration

## References

- https://v2.tauri.app/plugin/file-system/

## Keywords

tauri file system, read file, write file, scope, fs plugin, file access
More from partme-ai/full-stack-skills