Questions tagged [file-system-access-api]

Use this tag for questions about the W3C's File System Access API.

The W3C's File System Access API (currently being incubated), is a proposal for a new Web API that would give access to the user's disk.

This API allows to read or write Directories and Files on the user's disk.
It is currently exposed in Chromium based browsers.

Current specifications
Web.dev article

50 questions
12
votes
2 answers

DOMException: The request is not allowed by the user agent or the platform in the current context

When attempting to access a file using the getFile() method of a FileSystemFileHandle, this error can occur: DOMException: The request is not allowed by the user agent or the platform in the current context. This code works: async function…
James Gentes
  • 7,528
  • 7
  • 44
  • 64
9
votes
1 answer

Writing to files using File System Access API fails in Electron + Create React App

I have a create-react-app 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…
6
votes
2 answers

Access all files within a given folder (The File System Access API)

Can I use the File System Access API (https://web.dev/file-system-access/) to create something like a file explorer within a website (react). I plan to make a simple online file explorer that lets you browse open a folder and then lets you browse…
5
votes
1 answer

Renaming / moving files using File System Access API (javascript)

I've been following this article to allow users to (semi) automatically save a client side generated XML file to a specific local folder. A third party program is watching this folder and will process its contents and output content in another…
4
votes
2 answers

How to avoid two sequential alerts (one for read and one for edit) when using `window.showDirectoryPicker()`

const dirHandle = await window.showDirectoryPicker(); await dirHandle.requestPermission({ mode: "readwrite" }); I'm using the File System Access API in chrome. I'd like to let the user pick a folder, then write into the folder. My code works, but…
ZYinMD
  • 3,602
  • 1
  • 23
  • 32
4
votes
1 answer

How to recursively read local files and directories in web browser using File System Access API

I need to read all the files and directories of a folder opened with the new File System Access API for the web. I am able to read a directory but don't know how to continue recursively on an elegant way try { const directoryHandle =…
ctwhome
  • 753
  • 1
  • 13
  • 24
3
votes
1 answer

Is there a way to programmatically set the default directory with File System Access API

Is there a way to set a defined directory path programmatically instead of showing the file explorer with .showDirectoryPicker() for the user to select the actual path?
3
votes
1 answer

How do you get the selected directory path from file system access api window.showDirectoryPicker()

When I choose a folder I do get a dirHandle but cannot figure out what property or method will give me the full path const dirHandle = await window.showDirectoryPicker() So something like let path = dirHandle.fullpath Any ideas?
dan
  • 2,857
  • 6
  • 34
  • 60
2
votes
2 answers

Can I set a specific drive (e.g,"D:\") as a default directory for showOpenFilePicker?

We have a Java (JSP) web application and I want (well, the client) wants when they upload a file , based on a specific condition , the file picker to open directly in the D drive root directory. Also when they download a file, the file to be…
Marios
  • 339
  • 1
  • 14
2
votes
1 answer

File System Access API on Safari iOS - createSyncAccessHandle() UnknownError: 'invalid platform file handle'

I'm currently refactoring an app to use the OPFS to save images on an iPad for a use-case where a user needs to take pictures in a location that doesn't have wi-fi but storing all of the images in RAM will cause the iPad to crash. I've managed to…
2
votes
1 answer

How to iterate over the contents of a FileSystemDirectoryHandle?

I'm working on a chrome extension to streamline some of my work. This extension needs access to files on my computer in order to upload them and work with them. I'm trying to iterate over the contents of a directory using the File System Access API.…
2
votes
1 answer

Keeping FileSystemDirectoryHandle object in Chrome Extension

I'm working on Chrome extension. Inside popup I can run window.showDirectoryPicker(), which returns object of type FileSystemDirectoryHandle. My problem is that after changing tab in browser popup is automatically closed, so object is destroyed. My…
2
votes
1 answer

FileSystemHandle.requestPermission DOMException: User activation is required to request permissions

I need a open local file feature in my website, so I use File System Access API in my code. when the file opened from local is edited by my web and need to save to original file. I found it has no permission. Therefore, I find the way to request…
user2956843
  • 177
  • 1
  • 10
2
votes
2 answers

Is it possible to append to an existing file with Chrome's File System Access API

Using the new File System Access APIit is possible to read and write to files and folders on the user's device: const newHandle = await window.showSaveFilePicker(); const writableStream = await newHandle.createWritable(); await…
marlar
  • 3,858
  • 6
  • 37
  • 60
2
votes
2 answers

Accessing sub-directory file content using showDirectoryPicker()

Using the File System Access API, how would I access the files contained within a folder of the chosen directory? document.querySelector('button').addEventListener('click', async () => { const dirHandle = await window.showDirectoryPicker(); …
Conrad Klek
  • 143
  • 1
  • 8
1
2 3 4