felipecaparelli commented on issue #348:
URL:
https://github.com/apache/cordova-plugin-file/issues/348#issuecomment-687665048
I am just trying to use it (with Ionic) to get files from any Android
folders (WhatsApp, Documents, etc), but it always returns null, even using
other methods like readAsText, readAsDataURL or the readAsArrayBuffer. Follow
my config:
**Ionic:**
Ionic CLI : 5.4.15
Ionic Framework : @ionic/angular 5.2.2
@angular-devkit/build-angular : 0.901.9
@angular-devkit/schematics : 9.1.9
@angular/cli : 9.1.9
@ionic/angular-toolkit : 2.2.0
**Cordova:**
Cordova CLI : 9.0.0 ([email protected])
Cordova Platforms : android 8.1.0
Cordova Plugins :
cordova-plugin-file: 6.0.2
cordova-plugin-file-opener2: 3.0.4
cordova-plugin-filechooser: 1.2.0
cordova-plugin-filepath": 1.5.8
The code that fails is:
async openFiles() {
this.fileChooser
.open()
.then(contentPath => {
const that = this;
this.filePath.resolveNativePath(contentPath).then(uri
=> {
const lastSeparator = uri.lastIndexOf('/');
const fileName = uri.substr(lastSeparator + 1);
const sysPath = uri.substr(0, lastSeparator);
that.file.readAsArrayBuffer(sysPath,
fileName).then(buff => {
// buff is always null
const blob = new Blob([new
Uint8Array(buff)], { type: 'image/jpg' });
});
});
});
}
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]