GoogleChromeLabs / browser-fs-access

File System Access API with legacy fallback in the browser
https://googlechromelabs.github.io/browser-fs-access/demo/
Apache License 2.0
1.38k stars 84 forks source link

Add support for persisting file folder handle in indexdb for permissions #73

Closed delebash closed 2 years ago

delebash commented 2 years ago

In your article https://web.dev/browser-fs-access/ you showed a method of persisting access. It would be have this functionality included. TY

tomayac commented 2 years ago

You can do this as described in the main File System Access API article. You can get the required file handle as described below:

const previouslyOpenedBlob = await fileOpen();
// Optional file handle to save back to an existing file.
// This will only work with the File System Access API.
// Get a `FileHandle` from the `handle` property of the `Blob`
// you receive from `fileOpen()` (this is non-standard).
const existingHandle = previouslyOpenedBlob.handle;