how to open (doc, ppt, xlsx, pdf, jpg ,png) file using ionic native file opener
finally i got solution.
let fileExtn=file_name.split('.').reverse()[0];
let fileMIMEType=this.getMIMEtype(fileExtn);
this.fileOpener.open("file:///storage/emulated/0/download/"+ file_name+"", fileMIMEType)
.then(() => console.log('File is opened'))
.catch(e => console.log('Error openening file', e));
make other function for MIMEtype
getMIMEtype(extn){
let ext=extn.toLowerCase();
let MIMETypes={
'txt' :'text/plain',
'docx':'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'doc' : 'application/msword',
'pdf' : 'application/pdf',
'jpg' : 'image/jpeg',
'bmp' : 'image/bmp',
'png' : 'image/png',
'xls' : 'application/vnd.ms-excel',
'xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'rtf' : 'application/rtf',
'ppt' : 'application/vnd.ms-powerpoint',
'pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
}
return MIMETypes[ext];
}