Pds Ink
Pds Ink

Reputation: 765

read file name with fileSystem.createReader

I'm trying to access to a folder with some files using cordova-file and fileSystem.createReader method, and it works

The problem is that the function return me an object, and i want to see the file name.

here my code

       function listDir(path){
      window.resolveLocalFileSystemURL(path,
        function (fileSystem) {
          var reader = fileSystem.createReader();
          reader.readEntries(
            function (entries) {
              alert(entries);
            },
            function (err) {
              alert(err);
            }
          );
        }, function (err) {
          alert(err);
        }
      );
    } 
    listDir(cordova.file.applicationDirectory + "www/pdf"); 

here the response

[object,object],[object,object]

Upvotes: 0

Views: 1003

Answers (1)

Djiggy
Djiggy

Reputation: 602

entries is a list of FileEntry. Iterate on this list to have each FileEntry object, and retrieve file name using myFileEntry.name

Upvotes: 1

Related Questions