@tauri-apps/plugin-fs 2.4.0 → 2.4.2

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 CHANGED
@@ -33,21 +33,12 @@ tauri-plugin-fs = { git = "https://github.com/tauri-apps/plugins-workspace", bra
33
33
 
34
34
  You can install the JavaScript Guest bindings using your preferred JavaScript package manager:
35
35
 
36
- > 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.
37
-
38
36
  ```sh
39
37
  pnpm add @tauri-apps/plugin-fs
40
38
  # or
41
39
  npm add @tauri-apps/plugin-fs
42
40
  # or
43
41
  yarn add @tauri-apps/plugin-fs
44
-
45
- # alternatively with Git:
46
- pnpm add https://github.com/tauri-apps/tauri-plugin-fs#v2
47
- # or
48
- npm add https://github.com/tauri-apps/tauri-plugin-fs#v2
49
- # or
50
- yarn add https://github.com/tauri-apps/tauri-plugin-fs#v2
51
42
  ```
52
43
 
53
44
  ## Usage
package/dist-js/index.cjs CHANGED
@@ -641,7 +641,12 @@ async function writeFile(path, data, options) {
641
641
  throw new TypeError('Must be a file URL.');
642
642
  }
643
643
  if (data instanceof ReadableStream) {
644
- const file = await open(path, options);
644
+ const file = await open(path, {
645
+ read: false,
646
+ create: true,
647
+ write: true,
648
+ ...options
649
+ });
645
650
  const reader = data.getReader();
646
651
  try {
647
652
  while (true) {
@@ -536,7 +536,7 @@ interface ReadFileOptions {
536
536
  *
537
537
  * @since 2.0.0
538
538
  */
539
- declare function readFile(path: string | URL, options?: ReadFileOptions): Promise<Uint8Array>;
539
+ declare function readFile(path: string | URL, options?: ReadFileOptions): Promise<Uint8Array<ArrayBuffer>>;
540
540
  /**
541
541
  * Reads and returns the entire contents of a file as UTF-8 string.
542
542
  * @example
package/dist-js/index.js CHANGED
@@ -639,7 +639,12 @@ async function writeFile(path, data, options) {
639
639
  throw new TypeError('Must be a file URL.');
640
640
  }
641
641
  if (data instanceof ReadableStream) {
642
- const file = await open(path, options);
642
+ const file = await open(path, {
643
+ read: false,
644
+ create: true,
645
+ write: true,
646
+ ...options
647
+ });
643
648
  const reader = data.getReader();
644
649
  try {
645
650
  while (true) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-fs",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Access the file system.",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "authors": [
@@ -25,6 +25,6 @@
25
25
  "LICENSE"
26
26
  ],
27
27
  "dependencies": {
28
- "@tauri-apps/api": "^2.6.0"
28
+ "@tauri-apps/api": "^2.8.0"
29
29
  }
30
30
  }