mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
docs: update README.md and remove allowlist information (#381)
This commit is contained in:
committed by
GitHub
parent
d677f73495
commit
f4069f5588
+10
-1
@@ -1,4 +1,4 @@
|
||||

|
||||
# File System
|
||||
|
||||
Access the file system.
|
||||
|
||||
@@ -18,6 +18,8 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
tauri-plugin-fs = "2.0.0-alpha"
|
||||
# alternatively with Git:
|
||||
tauri-plugin-fs = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
||||
```
|
||||
|
||||
@@ -26,6 +28,13 @@ You can install the JavaScript Guest bindings using your preferred JavaScript pa
|
||||
> Note: Since most JavaScript package managers are unable to install packages from git monorepos we provide read-only mirrors of each plugin. This makes installation option 2 more ergonomic to use.
|
||||
|
||||
```sh
|
||||
pnpm add @tauri-apps/plugin-fs
|
||||
# or
|
||||
npm add @tauri-apps/plugin-fs
|
||||
# or
|
||||
yarn add @tauri-apps/plugin-fs
|
||||
|
||||
# alternatively with Git:
|
||||
pnpm add https://github.com/tauri-apps/tauri-plugin-fs#v2
|
||||
# or
|
||||
npm add https://github.com/tauri-apps/tauri-plugin-fs#v2
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB |
@@ -5,32 +5,6 @@
|
||||
/**
|
||||
* Access the file system.
|
||||
*
|
||||
* This package is also accessible with `window.__TAURI__.fs` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
|
||||
*
|
||||
* The APIs must be added to [`tauri.allowlist.fs`](https://tauri.app/v1/api/config/#allowlistconfig.fs) in `tauri.conf.json`:
|
||||
* ```json
|
||||
* {
|
||||
* "tauri": {
|
||||
* "allowlist": {
|
||||
* "fs": {
|
||||
* "all": true, // enable all FS APIs
|
||||
* "readFile": true,
|
||||
* "writeFile": true,
|
||||
* "readDir": true,
|
||||
* "copyFile": true,
|
||||
* "createDir": true,
|
||||
* "removeDir": true,
|
||||
* "removeFile": true,
|
||||
* "renameFile": true,
|
||||
* "metadata": true,
|
||||
* "exists": true
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
* It is recommended to allowlist only the APIs you use for optimal bundle size and security.
|
||||
*
|
||||
* ## Security
|
||||
*
|
||||
* This module prevents path traversal, not allowing absolute paths or parent dir components
|
||||
@@ -45,11 +19,9 @@
|
||||
* *databases* folder of the {@link path.appDataDir | $APPDATA directory}:
|
||||
* ```json
|
||||
* {
|
||||
* "tauri": {
|
||||
* "allowlist": {
|
||||
* "fs": {
|
||||
* "scope": ["$APPDATA/databases/*"]
|
||||
* }
|
||||
* "plugins": {
|
||||
* "fs": {
|
||||
* "scope": ["$APPDATA/databases/*"]
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
|
||||
@@ -80,7 +80,7 @@ fn push_pattern<P: AsRef<Path>, F: Fn(&str) -> Result<Pattern, glob::PatternErro
|
||||
}
|
||||
|
||||
impl Scope {
|
||||
/// Creates a new scope from a `FsAllowlistScope` configuration.
|
||||
/// Creates a new scope from a `FsScope` configuration.
|
||||
pub(crate) fn new<R: Runtime, M: Manager<R>>(
|
||||
manager: &M,
|
||||
scope: &FsScope,
|
||||
|
||||
Reference in New Issue
Block a user