We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 38deef4 commit e4a34c9Copy full SHA for e4a34c9
1 file changed
plugins/fs/guest-js/index.ts
@@ -1075,9 +1075,18 @@ async function writeFile(
1075
1076
if (data instanceof ReadableStream) {
1077
const file = await open(path, options)
1078
- for await (const chunk of data) {
1079
- await file.write(chunk)
+ const reader = data.getReader()
+
1080
+ try {
1081
+ while (true) {
1082
+ const { done, value } = await reader.read()
1083
+ if (done) break
1084
+ await file.write(value)
1085
+ }
1086
+ } finally {
1087
+ reader.releaseLock()
1088
}
1089
1090
await file.close()
1091
} else {
1092
await invoke('plugin:fs|write_file', data, {
0 commit comments