ionic 5 cordova file plugin code example
Example: ionic get file from device
import { FilePath } from '@ionic-native/file-path/ngx';
import { File, FileEntry } from '@ionic-native/File/ngx';
// uri is something like file:///data/user/0/com.company.app/files/1591951119970.jpeg
this.file.resolveLocalFilesystemUrl(finalPhotoUri.uri)
.then(entry => {
(<FileEntry>entry).file(file => {
// this is the actual file as File object
const photo = this.imageService.readFile(file);
console.log(photo);
}
);
})
.catch(err => {
console.log('Error while reading file.');
});