Need help upgrading to Ionic Framework 4.0? Get assistance with our Enterprise Migration Services EXPLORE NOW

File Opener

Improve this doc

This plugin will open a file on your device file system with its default application.

Repo: https://github.com/pwlin/cordova-plugin-file-opener2

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-file-opener2
    $ npm install --save @ionic-native/file-opener@4
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { FileOpener } from '@ionic-native/file-opener';

constructor(private fileOpener: FileOpener) { }

...

this.fileOpener.open('path/to/file.pdf', 'application/pdf')
  .then(() => console.log('File is opened'))
  .catch(e => console.log('Error opening file', e));

Instance Members

open(filePath, fileMIMEType)

Open an file

Param Type Details
filePath string

File Path

fileMIMEType string

File MIME Type

Returns: Promise<any>

uninstall(packageId)

Uninstalls a package

Param Type Details
packageId string

Package ID

Returns: Promise<any>

appIsInstalled(packageId)

Check if an app is already installed

Param Type Details
packageId string

Package ID

Returns: Promise<any>

API

Native

General