Base64 - Not allowed to load local resource


Hello! I am trying to convert a file to base64 using this plugin ( I am using the code as described

let filePath: string = 'file:///...';
this.base64.encodeFile(filePath).then((base64File: string) => {
}, (err) => {

When I import it with the /ngx extension I get the following error by running: ionic Cordova iOS build:

[12:38:36]  typescript: src/pages/contact/contact.ts, line: 9 
            Cannot find module '@ionic-native/base64/ngx'. 

       L8:  import { File } from '@ionic-native/file';
       L9:  import { Base64 } from '@ionic-native/base64/ngx';

[12:38:36]  ionic-app-script task: "build" 
[12:38:36]  Error: Failed to transpile program 

So I removed the /ngx and did:

import { Base64 } from '@ionic-native/base64';

But when I try to execute this function I get the following error:

Not allowed to load local resource: file:////var/mobile....

I also tried removing the file:/// parameter which ends up in cannot load http://localhost:8080/var/m. But his is also not like it should be used like mentioned here: stackoverflow.

my config is as follow:


   ionic (Ionic CLI)  : 4.7.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1


   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 9 other plugins)


   ios-deploy : 1.9.4
   NodeJS     : v11.6.0 (/usr/local/bin/node)
   npm        : 6.7.0
   OS         : macOS Mojave
   Xcode      : Xcode 10.1 Build version 10B61

So mentioned to the plugin described here:

for Cordova >= 5.0.0
cordova plugin add com-badrit-base64

It should work like mentioned in the documentation? My plugin version is com-badrit-base64 0.2.0 “Base64”. Help is really appreciated. Also an alternative way in converting an audio file to base64. Thanks.


Btw, this should be not a CORS problem because I am using it on my live device. Should it?