Capacitor readdir() hangs with some paths

I am experimenting with the Capacitor Filesystem methods just as a learning experience. I’m building a simple little app to traverse the file directory tree and display directories and files. I use Filesystem.readdir(), and I want to start with root (file:///) and traverse the entire tree, at least what I have access to.

When I call readdir() it hangs on the first or second iteration–never returns with or without an error. This happens on both a physical device (Android 8.0 on a Samsung S7) and the Pixel emulator in Android Studio.

On the Pixel emulator, the first readdir() hangs on ‘file:///’.
On the Samsung physical device it hangs on the 2nd call to readdir, after it gets the first sub-directory. It successfully returns the file list from root (file:///) and then calls readdir on the first directory under root: (file:///persdata) which returns the file list “absolute,” a directory. When I call readdir() on that directory “file:///persdata/absolute” it hangs.

On both the emulator and physical device, if I start at “file:///etc” then everything works fine and I can traverse the /etc directory tree, including sub-directories.

My guess is it relates to a permissions problem, which I can handle if the call to readdir() would return with an error. I have a try / catch around the call, and I’m using async / await.

I’ve attached the ts code, as simple as I can get it to demonstrate the problem.

thanks,
Rick

export class HomePage {

  constructor() { }

   async ngOnInit() {

    console.log("===>>> in ngOnInit");
    await this.getFiles();
    console.log("end of ngOnInit <<<===");
  }

  async getFiles() {
    // let startPath = 'file:///etc';
    let startPath = 'file:///';
    let ret: ReaddirResult = null;

    console.log("===>>> calling readdir with ", startPath);
    try {
      ret = await Filesystem.readdir({ path: startPath});          // hangs here in readdir
    } catch (e) { console.log("!!! readdir failed with ", e) };     // no error is generated

    if(ret) console.log("after call to readdir, ret=", ret);          // we never get here

    console.log("end of rewreaddir <<<===");                       // we never get here
  }
}

==========================

Ionic:

   Ionic CLI                     : 5.2.4 (C:\Users\rick\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.7.4
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Capacitor:

   Capacitor CLI   : 1.1.1
   @capacitor/core : 1.1.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.0.0, browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 6 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 0.2.8

System:

   NodeJS : v10.16.2 (C:\Program Files\nodejs\node.exe)
   npm    : 6.9.0
   OS     : Windows 10