You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/07/04 15:18:40 UTC

[GitHub] [cordova-plugin-file] koraysels edited a comment on issue #333: FileEntry.file is not a function

koraysels edited a comment on issue #333: FileEntry.file is not a function
URL: https://github.com/apache/cordova-plugin-file/issues/333#issuecomment-508516366
 
 
   Actually I found it is a bug that more people are having this error code and it is a bug in cordova.. 
   
   right now I figured it out for iOS by doing the following:
   
   ```
     window.requestFileSystem(window.LocalFileSystem.PERSISTENT, 0, async fs => {
             window.resolveLocalFileSystemURL(this.file.documentsDirectory, async dirEntry => {
               let justTheNameOfTheFile = filePathWeWantToRead.split('://')[1];
   
               dirEntry.getFile(justTheNameOfTheFile, { create: false, exclusive: false }, fileEntry => {
                 console.log('fileEntry -> ' + fileEntry);
                 this.readFile(fileEntry, resolve, reject); //this is the function of the first post
               });
             }, (error) => {
               console.error('something went wrong with resolving the file, trying to resolve without FilesystemURL');
               console.error(error);
             });
           });
   ```
   
   Now this works in iOS when creating the file with Media.create in the `cordova.file.documentsDirectory` So that is solved.,. only android won't work yet.. On Android the same file is also created the same way but stored in `cordova.file.externalApplicationStorageDirectory`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org