How to use Capacitor's convertFileSrc() instead of Cordova's convertFileSrc()?

Can someone give me an example of how to pull convertFileSrc() from Capacitor instead of using the one from cordova?

I need this because if I use the cordova one, then I cannot run my code in the browser anymore – because cordova.js does not support the browser.

Thanks.

Import Capacitor from @capacitor/core:

import { Capacitor } from '@capacitor/core';

and use it like this:

Capacitor.convertFileSrc('file:///your/file/path');

1 Like

Thanks! This is not documented anywhere in the Capacitor docs, as far as I can tell.

But, I guess it is documented here, now… :slight_smile:

1 Like