Ionic-native: readAsDataURL doesnt work in @ionic-native/file(3.x)

Created on 13 May 2017  路  9Comments  路  Source: ionic-team/ionic-native

Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

When invoking readAsDataURL method, it doesn't trigger the callback or throw any errors, then I try to revert it to [email protected], then everything is working fine.

Expected behavior:

readAsDataURL should trigger the callback.

Steps to reproduce:

this.file.readAsDataURL(this.file.dataDirectory + 'temp/', 'test.png').then(data => {
// not triggered
}, error => {
// not triggered
}).catch(error => {
// not triggered
})

Cordova CLI: 6.4.0
Ionic Framework Version: 3.2.0
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: macOS Sierra
Node Version: v6.7.0
Xcode version: Xcode 8.3.2 Build version 8E2002

file

Most helpful comment

Tested with 3.8.0 and it works well @xupea

All 9 comments

What version of @ionic-native/file are you using?

@ihadeed , 3.6.1 and 3.7.0

readAsText is also not working/never complete. Some ppl in #464 also have this problem too.

@grapemix ,then we have to use 2.9.1 instead since it's working for me

Tested with 3.8.0 and it works well @xupea

@ihadeed ,thanks it works for me as well.

I have the same problem with the following environment:
Ionic:

ionic (Ionic CLI) : 4.2.1
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : not available
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 10 other plugins)

System:

Android SDK Tools : 26.1.1
NodeJS : v8.12.0
npm : 6.4.1
OS : Windows 10

"@ionic-native/file": "^4.16.0",

@rulight, have you find any solution?

@rulight, have you find any solution?
@vivekwaghamare48 Yes, it was actually a problem with the diretory path, I think I just had to remove the last / from the path, but I had to do a lot of compiling in order to check if the directory was being referenced correctly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jgw96 picture jgw96  路  3Comments

ajcrites picture ajcrites  路  3Comments

Manduro picture Manduro  路  3Comments

goleary picture goleary  路  3Comments

vaibsVB picture vaibsVB  路  4Comments