You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Nikita Matrosov (JIRA)" <ji...@apache.org> on 2017/06/07 12:34:18 UTC

[jira] [Commented] (CB-12827) readAsText and readAsDataURL error

    [ https://issues.apache.org/jira/browse/CB-12827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040787#comment-16040787 ] 

Nikita Matrosov commented on CB-12827:
--------------------------------------

[~MrShakes], you need to use {{cordova.file.cacheDirectory}} rather than {{cordova.file.cache}} (see docs https://github.com/apache/cordova-plugin-file#where-to-store-files)

> readAsText and readAsDataURL error
> ----------------------------------
>
>                 Key: CB-12827
>                 URL: https://issues.apache.org/jira/browse/CB-12827
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-file, Ionic
>    Affects Versions: 6.4.0
>         Environment: Android KitKat 4.4.2
>            Reporter: Olabosipo Shoroye
>
> I'm using ngCordova cordova-plugin-file to try to read an image that I then want to convert to bytes. I actually want to read it as dataURL and I'm getting an error.
> /* The image is located at file:///data/data/com.xxx.housekeeping/cache/tmp_Screenshot_2017-04-27-09-30-42-1816635709.png on an Android device */
> `$cordovaFile.readAsText(cordova.file.cache, "tmp_Screenshot_2017-04-27-09-30-421403920141.png")
>       .then(function (success) {
>         // success
>         console.log(success);
>       }, function (error) {
>         // error
>         console.log(error);
>       });`
> I tried using both readAsText and readAsDataURL but I get
> `Wrong type for parameter "uri" of resolveLocalFileSystemURI: Expected String, but got Undefined.`
> as an error. This is on an Android device.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

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