Skip to content

Conversation

amrbashir
Copy link
Member

closes #1598

@amrbashir amrbashir requested a review from a team as a code owner October 21, 2024 17:12
Copy link
Contributor

github-actions bot commented Oct 21, 2024

Package Changes Through 5703494

There are 14 changes which include upload with minor, upload-js with minor, deep-link with patch, deep-link-js with patch, log-plugin with patch, log-js with patch, fs with patch, fs-js with patch, localhost with minor, opener with major, opener-js with major, positioner-js with minor, positioner with minor, sql with patch

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
api-example 2.0.5 2.0.6
api-example-js 2.0.2 2.0.3
deep-link-example-js 2.0.0 2.0.1
deep-link 2.0.1 2.0.2
deep-link-js 2.0.0 2.0.1
fs 2.0.3 2.0.4
fs-js 2.0.2 2.0.3
dialog 2.0.3 2.0.4
opener 1.0.0 2.0.0
opener-js 1.0.0 2.0.0
http 2.0.3 2.0.4
localhost 2.0.1 2.1.0
log-plugin 2.0.2 2.0.3
log-js 2.0.0 2.0.1
persisted-scope 2.0.3 2.0.4
positioner 2.0.2 2.1.0
positioner-js 2.0.1 2.1.0
single-instance 2.0.1 2.0.2
sql 2.0.2 2.0.3
upload 2.1.0 2.2.0
upload-js 2.1.0 2.2.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@amrbashir amrbashir requested a review from FabianLars November 21, 2024 12:33
@FabianLars
Copy link
Member

tbh i'm still a bit confused why the allow and deny arrays don't match but i assume it's correct. Ah no, is it because users may want to deny write_file but still use open/write?

@amrbashir amrbashir merged commit 5092ea5 into v2 Nov 21, 2024
37 checks passed
@amrbashir amrbashir deleted the feat/fs/stream-writeFile branch November 21, 2024 12:49
@amrbashir
Copy link
Member Author

tbh i'm still a bit confused why the allow and deny arrays don't match but i assume it's correct. Ah no, is it because users may want to deny write_file but still use open/write?

yeah

@tjramage
Copy link
Contributor

Hey @amrbashir @FabianLars – just a quick heads-up that I don't think this actually works on macOS (15.3.1). I get a TypeError on the for await (const chunk of data) line:

TypeError: undefined is not a function (near '...chunk of data...')

Async iterator support on Safari is not currently in place (https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#browser_compatibility)

I had to drop in a polyfill for this to work:

ReadableStream.prototype[Symbol.asyncIterator] = async function* () {
  const reader = this.getReader()
  try {
    while (true) {
      const {done, value} = await reader.read()
      if (done) return
      yield value
    }
  }
  finally {
    reader.releaseLock()
  }
}

Do you need me to create a separate issue? Happy to provide more info if needed.

@amrbashir
Copy link
Member Author

amrbashir commented Mar 19, 2025

@tjramage thanks for the heads up, I forgot to check if it was supported on all platforms. Would you like to open a PR to change from async iterator to manual read, same as you did in the polyfill? or just open an issue if you like so I don't forget.

@tjramage
Copy link
Contributor

@amrbashir – no problem, leave the PR with me 👍

gezihuzi pushed a commit to Hypobenthos/plugins-workspace that referenced this pull request Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use stream in tauri-plugin-fs writeFile

3 participants