cordova read file from directory code example

Example: cordova read file in www folder

function listDir(path){
  window.resolveLocalFileSystemURL(path,
    function (fileSystem) {
      var reader = fileSystem.createReader();
      reader.readEntries(
        function (entries) {
          console.log(entries);
        },
        function (err) {
          console.log(err);
        }
      );
    }, function (err) {
      console.log(err);
    }
  );
}
//example: list of www/ folder in cordova/ionic app.
listDir(cordova.file.applicationDirectory + "www/");