@tauri-apps/plugin-fs 2.0.0-alpha.5 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist-js/index.cjs +3 -3
- package/dist-js/index.d.ts +61 -14
- package/dist-js/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
|
|
|
18
18
|
|
|
19
19
|
```toml
|
|
20
20
|
[dependencies]
|
|
21
|
-
tauri-plugin-fs = "2.0.0-
|
|
21
|
+
tauri-plugin-fs = "2.0.0-beta"
|
|
22
22
|
# alternatively with Git:
|
|
23
23
|
tauri-plugin-fs = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
|
|
24
24
|
```
|
package/dist-js/index.cjs
CHANGED
|
@@ -639,8 +639,8 @@ async function exists(path, options) {
|
|
|
639
639
|
options,
|
|
640
640
|
});
|
|
641
641
|
}
|
|
642
|
-
async function unwatch(
|
|
643
|
-
await core.invoke("plugin:fs|unwatch", {
|
|
642
|
+
async function unwatch(rid) {
|
|
643
|
+
await core.invoke("plugin:fs|unwatch", { rid });
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
646
|
* Watch changes (after a delay) on files or directories.
|
|
@@ -699,7 +699,7 @@ async function watchImmediate(paths, cb, options) {
|
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
-
Object.defineProperty(exports,
|
|
702
|
+
Object.defineProperty(exports, "BaseDirectory", {
|
|
703
703
|
enumerable: true,
|
|
704
704
|
get: function () { return path.BaseDirectory; }
|
|
705
705
|
});
|
package/dist-js/index.d.ts
CHANGED
|
@@ -666,6 +666,8 @@ interface WriteFileOptions {
|
|
|
666
666
|
append?: boolean;
|
|
667
667
|
/** Sets the option to allow creating a new file, if one doesn't already exist at the specified path (defaults to `true`). */
|
|
668
668
|
create?: boolean;
|
|
669
|
+
/** Sets the option to create a new file, failing if it already exists. */
|
|
670
|
+
createNew?: boolean;
|
|
669
671
|
/** File permissions. Ignored on Windows. */
|
|
670
672
|
mode?: number;
|
|
671
673
|
/** Base directory for `path` */
|
|
@@ -735,32 +737,77 @@ interface DebouncedWatchOptions extends WatchOptions {
|
|
|
735
737
|
/**
|
|
736
738
|
* @since 2.0.0
|
|
737
739
|
*/
|
|
738
|
-
type
|
|
739
|
-
type:
|
|
740
|
+
type WatchEvent = {
|
|
741
|
+
type: WatchEventKind;
|
|
740
742
|
paths: string[];
|
|
741
743
|
attrs: unknown;
|
|
742
744
|
};
|
|
743
745
|
/**
|
|
744
746
|
* @since 2.0.0
|
|
745
747
|
*/
|
|
746
|
-
type
|
|
747
|
-
access
|
|
748
|
+
type WatchEventKind = "any" | {
|
|
749
|
+
access: WatchEventKindAccess;
|
|
748
750
|
} | {
|
|
749
|
-
create
|
|
751
|
+
create: WatchEventKindCreate;
|
|
750
752
|
} | {
|
|
751
|
-
modify
|
|
753
|
+
modify: WatchEventKindModify;
|
|
752
754
|
} | {
|
|
753
|
-
remove
|
|
755
|
+
remove: WatchEventKindRemove;
|
|
754
756
|
} | "other";
|
|
755
757
|
/**
|
|
756
758
|
* @since 2.0.0
|
|
757
759
|
*/
|
|
758
|
-
type
|
|
760
|
+
type WatchEventKindAccess = {
|
|
761
|
+
kind: "any";
|
|
762
|
+
} | {
|
|
763
|
+
kind: "close";
|
|
764
|
+
mode: "any" | "execute" | "read" | "write" | "other";
|
|
765
|
+
} | {
|
|
766
|
+
kind: "open";
|
|
767
|
+
mode: "any" | "execute" | "read" | "write" | "other";
|
|
768
|
+
} | {
|
|
769
|
+
kind: "other";
|
|
770
|
+
};
|
|
771
|
+
/**
|
|
772
|
+
* @since 2.0.0
|
|
773
|
+
*/
|
|
774
|
+
type WatchEventKindCreate = {
|
|
775
|
+
kind: "any";
|
|
776
|
+
} | {
|
|
777
|
+
kind: "file";
|
|
778
|
+
} | {
|
|
779
|
+
kind: "folder";
|
|
780
|
+
} | {
|
|
781
|
+
kind: "other";
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* @since 2.0.0
|
|
785
|
+
*/
|
|
786
|
+
type WatchEventKindModify = {
|
|
787
|
+
kind: "any";
|
|
788
|
+
} | {
|
|
789
|
+
kind: "data";
|
|
790
|
+
mode: "any" | "size" | "content" | "other";
|
|
791
|
+
} | {
|
|
792
|
+
kind: "metadata";
|
|
793
|
+
mode: "any" | "access-time" | "write-time" | "permissions" | "ownership" | "extended" | "other";
|
|
794
|
+
} | {
|
|
795
|
+
kind: "name";
|
|
796
|
+
mode: "any" | "to" | "from" | "both" | "other";
|
|
797
|
+
} | {
|
|
798
|
+
kind: "other";
|
|
799
|
+
};
|
|
800
|
+
/**
|
|
801
|
+
* @since 2.0.0
|
|
802
|
+
*/
|
|
803
|
+
type WatchEventKindRemove = {
|
|
759
804
|
kind: "any";
|
|
760
|
-
path: string;
|
|
761
805
|
} | {
|
|
762
|
-
kind: "
|
|
763
|
-
|
|
806
|
+
kind: "file";
|
|
807
|
+
} | {
|
|
808
|
+
kind: "folder";
|
|
809
|
+
} | {
|
|
810
|
+
kind: "other";
|
|
764
811
|
};
|
|
765
812
|
/**
|
|
766
813
|
* @since 2.0.0
|
|
@@ -771,12 +818,12 @@ type UnwatchFn = () => void;
|
|
|
771
818
|
*
|
|
772
819
|
* @since 2.0.0
|
|
773
820
|
*/
|
|
774
|
-
declare function watch(paths: string | string[] | URL | URL[], cb: (event:
|
|
821
|
+
declare function watch(paths: string | string[] | URL | URL[], cb: (event: WatchEvent) => void, options?: DebouncedWatchOptions): Promise<UnwatchFn>;
|
|
775
822
|
/**
|
|
776
823
|
* Watch changes on files or directories.
|
|
777
824
|
*
|
|
778
825
|
* @since 2.0.0
|
|
779
826
|
*/
|
|
780
|
-
declare function watchImmediate(paths: string | string[] | URL | URL[], cb: (event:
|
|
781
|
-
export type { CreateOptions, OpenOptions, CopyFileOptions, MkdirOptions, DirEntry, ReadDirOptions, ReadFileOptions, RemoveOptions, RenameOptions, StatOptions, TruncateOptions, WriteFileOptions, ExistsOptions, FileInfo, WatchOptions, DebouncedWatchOptions,
|
|
827
|
+
declare function watchImmediate(paths: string | string[] | URL | URL[], cb: (event: WatchEvent) => void, options?: WatchOptions): Promise<UnwatchFn>;
|
|
828
|
+
export type { CreateOptions, OpenOptions, CopyFileOptions, MkdirOptions, DirEntry, ReadDirOptions, ReadFileOptions, RemoveOptions, RenameOptions, StatOptions, TruncateOptions, WriteFileOptions, ExistsOptions, FileInfo, WatchOptions, DebouncedWatchOptions, WatchEvent, WatchEventKind, WatchEventKindAccess, WatchEventKindCreate, WatchEventKindModify, WatchEventKindRemove, UnwatchFn, };
|
|
782
829
|
export { BaseDirectory, FileHandle, create, open, copyFile, mkdir, readDir, readFile, readTextFile, readTextFileLines, remove, rename, SeekMode, stat, lstat, truncate, writeFile, writeTextFile, exists, watch, watchImmediate, };
|
package/dist-js/index.js
CHANGED
|
@@ -637,8 +637,8 @@ async function exists(path, options) {
|
|
|
637
637
|
options,
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
|
-
async function unwatch(
|
|
641
|
-
await invoke("plugin:fs|unwatch", {
|
|
640
|
+
async function unwatch(rid) {
|
|
641
|
+
await invoke("plugin:fs|unwatch", { rid });
|
|
642
642
|
}
|
|
643
643
|
/**
|
|
644
644
|
* Watch changes (after a delay) on files or directories.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-fs",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "Access the file system.",
|
|
5
5
|
"license": "MIT or APACHE-2.0",
|
|
6
6
|
"authors": [
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tauri-apps/api": "2.0.0-
|
|
24
|
+
"@tauri-apps/api": "2.0.0-beta.0"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "rollup -c"
|