Readdir() of /Data not working?

I am trying to get a list of all files in the FilesystemDirectory.Data filesystem. Here is my code:

export const removeAllDataFiles = () => {
  return Filesystem.readdir({
    path: '',
    directory: FilesystemDirectory.Data,
  });
};

I get an error back: Error: Uncaught (in promise): Error: Folder does not exist.

If I set path to '/' or '.' I still get the same error.

Is there any way to read all files in the Data directory?

it’s not possible at the moment

That’s really disappointing… A system where you can’t do an ls on your “home” directory…

You can report the issue https://github.com/ionic-team/capacitor/issues

In fact, I was wrong, it’s working fine for all platforms if you pass ‘’ as path, except for web. I’ve sent a PR fixing it https://github.com/ionic-team/capacitor/pull/1818.

For you it was not working on any platform because you were using the web implementation for all (according to No permission to read a file my app wrote to /Data dir?)