Skip to content
This repository was archived by the owner on Jan 15, 2023. It is now read-only.
This repository was archived by the owner on Jan 15, 2023. It is now read-only.

Writing to files using File System Access API fails #328

Description

@CarlosGabado

I have a that reads and writes local files using File System Access API. When run in a browser (Chrome or Edge that support it), both reading and writing files work fine.

When the app is run in Electron, reading works but writing fails due to: Uncaught (in promise) DOMException: The request is not allowed by the user agent or the platform in the current context.

Here the function
`
async function chooseAndWriteToFile(contents) {
const fileHandle = await window.showSaveFilePicker()

  const descriptor = {
    writable: true,
    mode: "readwrite"
  }
  const permissionState = await fileHandle.requestPermission(descriptor)
  console.log(window.isSecureContext)
  console.log(permissionState)

  const writable = await fileHandle.createWritable()
  await writable.write(contents)
  await writable.close()
}

`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions