@tauri-apps/plugin-fs 2.0.0-beta.5 → 2.0.0-beta.6
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/dist-js/index.cjs +27 -27
- package/dist-js/index.d.ts +27 -26
- package/dist-js/index.js +27 -27
- package/package.json +2 -2
package/dist-js/index.cjs
CHANGED
|
@@ -20,7 +20,7 @@ var core = require('@tauri-apps/api/core');
|
|
|
20
20
|
*
|
|
21
21
|
* The scope configuration is an array of glob patterns describing folder paths that are allowed.
|
|
22
22
|
* For instance, this scope configuration only allows accessing files on the
|
|
23
|
-
* *databases* folder of the {@link https://
|
|
23
|
+
* *databases* folder of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
|
|
24
24
|
* ```json
|
|
25
25
|
* {
|
|
26
26
|
* "plugins": {
|
|
@@ -31,32 +31,32 @@ var core = require('@tauri-apps/api/core');
|
|
|
31
31
|
* }
|
|
32
32
|
* ```
|
|
33
33
|
*
|
|
34
|
-
* Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://
|
|
34
|
+
* Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | app data directory}.
|
|
35
35
|
*
|
|
36
36
|
* The available variables are:
|
|
37
|
-
* {@linkcode https://
|
|
38
|
-
* {@linkcode https://
|
|
39
|
-
* {@linkcode https://
|
|
40
|
-
* {@linkcode https://
|
|
41
|
-
* {@linkcode https://
|
|
42
|
-
* {@linkcode https://
|
|
43
|
-
* {@linkcode https://
|
|
44
|
-
* {@linkcode https://
|
|
45
|
-
* {@linkcode https://
|
|
46
|
-
* {@linkcode https://
|
|
47
|
-
* {@linkcode https://
|
|
48
|
-
* {@linkcode https://
|
|
49
|
-
* {@linkcode https://
|
|
50
|
-
* {@linkcode https://
|
|
51
|
-
* {@linkcode https://
|
|
52
|
-
* {@linkcode https://
|
|
53
|
-
* {@linkcode https://
|
|
54
|
-
* {@linkcode https://
|
|
55
|
-
* {@linkcode https://
|
|
56
|
-
* {@linkcode https://
|
|
57
|
-
* {@linkcode https://
|
|
58
|
-
* {@linkcode https://
|
|
59
|
-
* {@linkcode https://
|
|
37
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appconfigdir | $APPCONFIG},
|
|
38
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | $APPDATA},
|
|
39
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appLocaldatadir | $APPLOCALDATA},
|
|
40
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appcachedir | $APPCACHE},
|
|
41
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#applogdir | $APPLOG},
|
|
42
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#audiodir | $AUDIO},
|
|
43
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#cachedir | $CACHE},
|
|
44
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#configdir | $CONFIG},
|
|
45
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#datadir | $DATA},
|
|
46
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#localdatadir | $LOCALDATA},
|
|
47
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#desktopdir | $DESKTOP},
|
|
48
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#documentdir | $DOCUMENT},
|
|
49
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#downloaddir | $DOWNLOAD},
|
|
50
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#executabledir | $EXE},
|
|
51
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#fontdir | $FONT},
|
|
52
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#homedir | $HOME},
|
|
53
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#picturedir | $PICTURE},
|
|
54
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#publicdir | $PUBLIC},
|
|
55
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#runtimedir | $RUNTIME},
|
|
56
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#templatedir | $TEMPLATE},
|
|
57
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#videodir | $VIDEO},
|
|
58
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#resourcedir | $RESOURCE},
|
|
59
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#tempdir | $TEMP}.
|
|
60
60
|
*
|
|
61
61
|
* Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access.
|
|
62
62
|
*
|
|
@@ -345,6 +345,7 @@ async function mkdir(path, options) {
|
|
|
345
345
|
* @example
|
|
346
346
|
* ```typescript
|
|
347
347
|
* import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
348
|
+
* import { join } from '@tauri-apps/api/path';
|
|
348
349
|
* const dir = "users"
|
|
349
350
|
* const entries = await readDir('users', { baseDir: BaseDirectory.App });
|
|
350
351
|
* processEntriesRecursive(dir, entries);
|
|
@@ -352,7 +353,7 @@ async function mkdir(path, options) {
|
|
|
352
353
|
* for (const entry of entries) {
|
|
353
354
|
* console.log(`Entry: ${entry.name}`);
|
|
354
355
|
* if (entry.isDirectory) {
|
|
355
|
-
* const dir = parent
|
|
356
|
+
* const dir = await join(parent, entry.name);
|
|
356
357
|
* processEntriesRecursive(dir, await readDir(dir, { baseDir: BaseDirectory.App }))
|
|
357
358
|
* }
|
|
358
359
|
* }
|
|
@@ -447,7 +448,6 @@ async function readTextFileLines(path, options) {
|
|
|
447
448
|
if (done)
|
|
448
449
|
this.rid = null;
|
|
449
450
|
return {
|
|
450
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
451
451
|
value: done ? "" : line,
|
|
452
452
|
done,
|
|
453
453
|
};
|
package/dist-js/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The scope configuration is an array of glob patterns describing folder paths that are allowed.
|
|
14
14
|
* For instance, this scope configuration only allows accessing files on the
|
|
15
|
-
* *databases* folder of the {@link https://
|
|
15
|
+
* *databases* folder of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
|
|
16
16
|
* ```json
|
|
17
17
|
* {
|
|
18
18
|
* "plugins": {
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
* }
|
|
24
24
|
* ```
|
|
25
25
|
*
|
|
26
|
-
* Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://
|
|
26
|
+
* Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | app data directory}.
|
|
27
27
|
*
|
|
28
28
|
* The available variables are:
|
|
29
|
-
* {@linkcode https://
|
|
30
|
-
* {@linkcode https://
|
|
31
|
-
* {@linkcode https://
|
|
32
|
-
* {@linkcode https://
|
|
33
|
-
* {@linkcode https://
|
|
34
|
-
* {@linkcode https://
|
|
35
|
-
* {@linkcode https://
|
|
36
|
-
* {@linkcode https://
|
|
37
|
-
* {@linkcode https://
|
|
38
|
-
* {@linkcode https://
|
|
39
|
-
* {@linkcode https://
|
|
40
|
-
* {@linkcode https://
|
|
41
|
-
* {@linkcode https://
|
|
42
|
-
* {@linkcode https://
|
|
43
|
-
* {@linkcode https://
|
|
44
|
-
* {@linkcode https://
|
|
45
|
-
* {@linkcode https://
|
|
46
|
-
* {@linkcode https://
|
|
47
|
-
* {@linkcode https://
|
|
48
|
-
* {@linkcode https://
|
|
49
|
-
* {@linkcode https://
|
|
50
|
-
* {@linkcode https://
|
|
51
|
-
* {@linkcode https://
|
|
29
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appconfigdir | $APPCONFIG},
|
|
30
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | $APPDATA},
|
|
31
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appLocaldatadir | $APPLOCALDATA},
|
|
32
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appcachedir | $APPCACHE},
|
|
33
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#applogdir | $APPLOG},
|
|
34
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#audiodir | $AUDIO},
|
|
35
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#cachedir | $CACHE},
|
|
36
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#configdir | $CONFIG},
|
|
37
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#datadir | $DATA},
|
|
38
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#localdatadir | $LOCALDATA},
|
|
39
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#desktopdir | $DESKTOP},
|
|
40
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#documentdir | $DOCUMENT},
|
|
41
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#downloaddir | $DOWNLOAD},
|
|
42
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#executabledir | $EXE},
|
|
43
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#fontdir | $FONT},
|
|
44
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#homedir | $HOME},
|
|
45
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#picturedir | $PICTURE},
|
|
46
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#publicdir | $PUBLIC},
|
|
47
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#runtimedir | $RUNTIME},
|
|
48
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#templatedir | $TEMPLATE},
|
|
49
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#videodir | $VIDEO},
|
|
50
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#resourcedir | $RESOURCE},
|
|
51
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#tempdir | $TEMP}.
|
|
52
52
|
*
|
|
53
53
|
* Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access.
|
|
54
54
|
*
|
|
@@ -483,6 +483,7 @@ interface DirEntry {
|
|
|
483
483
|
* @example
|
|
484
484
|
* ```typescript
|
|
485
485
|
* import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
486
|
+
* import { join } from '@tauri-apps/api/path';
|
|
486
487
|
* const dir = "users"
|
|
487
488
|
* const entries = await readDir('users', { baseDir: BaseDirectory.App });
|
|
488
489
|
* processEntriesRecursive(dir, entries);
|
|
@@ -490,7 +491,7 @@ interface DirEntry {
|
|
|
490
491
|
* for (const entry of entries) {
|
|
491
492
|
* console.log(`Entry: ${entry.name}`);
|
|
492
493
|
* if (entry.isDirectory) {
|
|
493
|
-
* const dir = parent
|
|
494
|
+
* const dir = await join(parent, entry.name);
|
|
494
495
|
* processEntriesRecursive(dir, await readDir(dir, { baseDir: BaseDirectory.App }))
|
|
495
496
|
* }
|
|
496
497
|
* }
|
package/dist-js/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { Resource, invoke, Channel } from '@tauri-apps/api/core';
|
|
|
18
18
|
*
|
|
19
19
|
* The scope configuration is an array of glob patterns describing folder paths that are allowed.
|
|
20
20
|
* For instance, this scope configuration only allows accessing files on the
|
|
21
|
-
* *databases* folder of the {@link https://
|
|
21
|
+
* *databases* folder of the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | `$APPDATA` directory}:
|
|
22
22
|
* ```json
|
|
23
23
|
* {
|
|
24
24
|
* "plugins": {
|
|
@@ -29,32 +29,32 @@ import { Resource, invoke, Channel } from '@tauri-apps/api/core';
|
|
|
29
29
|
* }
|
|
30
30
|
* ```
|
|
31
31
|
*
|
|
32
|
-
* Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://
|
|
32
|
+
* Notice the use of the `$APPDATA` variable. The value is injected at runtime, resolving to the {@link https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | app data directory}.
|
|
33
33
|
*
|
|
34
34
|
* The available variables are:
|
|
35
|
-
* {@linkcode https://
|
|
36
|
-
* {@linkcode https://
|
|
37
|
-
* {@linkcode https://
|
|
38
|
-
* {@linkcode https://
|
|
39
|
-
* {@linkcode https://
|
|
40
|
-
* {@linkcode https://
|
|
41
|
-
* {@linkcode https://
|
|
42
|
-
* {@linkcode https://
|
|
43
|
-
* {@linkcode https://
|
|
44
|
-
* {@linkcode https://
|
|
45
|
-
* {@linkcode https://
|
|
46
|
-
* {@linkcode https://
|
|
47
|
-
* {@linkcode https://
|
|
48
|
-
* {@linkcode https://
|
|
49
|
-
* {@linkcode https://
|
|
50
|
-
* {@linkcode https://
|
|
51
|
-
* {@linkcode https://
|
|
52
|
-
* {@linkcode https://
|
|
53
|
-
* {@linkcode https://
|
|
54
|
-
* {@linkcode https://
|
|
55
|
-
* {@linkcode https://
|
|
56
|
-
* {@linkcode https://
|
|
57
|
-
* {@linkcode https://
|
|
35
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appconfigdir | $APPCONFIG},
|
|
36
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appdatadir | $APPDATA},
|
|
37
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appLocaldatadir | $APPLOCALDATA},
|
|
38
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#appcachedir | $APPCACHE},
|
|
39
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#applogdir | $APPLOG},
|
|
40
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#audiodir | $AUDIO},
|
|
41
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#cachedir | $CACHE},
|
|
42
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#configdir | $CONFIG},
|
|
43
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#datadir | $DATA},
|
|
44
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#localdatadir | $LOCALDATA},
|
|
45
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#desktopdir | $DESKTOP},
|
|
46
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#documentdir | $DOCUMENT},
|
|
47
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#downloaddir | $DOWNLOAD},
|
|
48
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#executabledir | $EXE},
|
|
49
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#fontdir | $FONT},
|
|
50
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#homedir | $HOME},
|
|
51
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#picturedir | $PICTURE},
|
|
52
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#publicdir | $PUBLIC},
|
|
53
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#runtimedir | $RUNTIME},
|
|
54
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#templatedir | $TEMPLATE},
|
|
55
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#videodir | $VIDEO},
|
|
56
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#resourcedir | $RESOURCE},
|
|
57
|
+
* {@linkcode https://v2.tauri.app/reference/javascript/api/namespacepath/#tempdir | $TEMP}.
|
|
58
58
|
*
|
|
59
59
|
* Trying to execute any API with a URL not configured on the scope results in a promise rejection due to denied access.
|
|
60
60
|
*
|
|
@@ -343,6 +343,7 @@ async function mkdir(path, options) {
|
|
|
343
343
|
* @example
|
|
344
344
|
* ```typescript
|
|
345
345
|
* import { readDir, BaseDirectory } from '@tauri-apps/plugin-fs';
|
|
346
|
+
* import { join } from '@tauri-apps/api/path';
|
|
346
347
|
* const dir = "users"
|
|
347
348
|
* const entries = await readDir('users', { baseDir: BaseDirectory.App });
|
|
348
349
|
* processEntriesRecursive(dir, entries);
|
|
@@ -350,7 +351,7 @@ async function mkdir(path, options) {
|
|
|
350
351
|
* for (const entry of entries) {
|
|
351
352
|
* console.log(`Entry: ${entry.name}`);
|
|
352
353
|
* if (entry.isDirectory) {
|
|
353
|
-
* const dir = parent
|
|
354
|
+
* const dir = await join(parent, entry.name);
|
|
354
355
|
* processEntriesRecursive(dir, await readDir(dir, { baseDir: BaseDirectory.App }))
|
|
355
356
|
* }
|
|
356
357
|
* }
|
|
@@ -445,7 +446,6 @@ async function readTextFileLines(path, options) {
|
|
|
445
446
|
if (done)
|
|
446
447
|
this.rid = null;
|
|
447
448
|
return {
|
|
448
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
449
449
|
value: done ? "" : line,
|
|
450
450
|
done,
|
|
451
451
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-fs",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.6",
|
|
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-beta.
|
|
24
|
+
"@tauri-apps/api": "2.0.0-beta.14"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "rollup -c"
|