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/03/29 10:49:19 UTC

[GitHub] [cordova-plugin-file] Benji1 commented on issue #289: All files reads gave a error code 5; ENCODING_ERR in latest release on Android

Benji1 commented on issue #289: All files reads gave a error code 5;  ENCODING_ERR in latest release on Android
URL: https://github.com/apache/cordova-plugin-file/issues/289#issuecomment-477954331
 
 
   @domingosl @alex-steinberg @RonCan 
   Try this:
   ```
   const justTheNameOfTheFile = "file.txt";
   window.requestFileSystem(window.LocalFileSystem.PERSISTENT, 0, async fs => {
         window.resolveLocalFileSystemURL(window.cordova.file.dataDirectory, async dirEntry => {
             dirEntry.getFile(justTheNameOfTheFile, { create: true, exclusive: false }, fileEntry => {
                    // what you want to do
               }
         });
   });
   ```
   It is because ```window.cordova.file.dataDirectory``` returns ```file:///data/user/0/...``` and ```.getFile``` checks if there is a ```:``` in the string and throws the encoding error then. But with the solution above it worked for me.

----------------------------------------------------------------
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