Using plugins to convert xml files and then saving them locally

Hello,
in my app I’m have access to to couple of .xml and .csv files which I’m converting using these plugins:
https://www.npmjs.com/package/xml-js and https://www.npmjs.com/package/json-2-csv
now i need to know how can i access one of these files (which are in another folder) and save them as a variable to pass these plugins to convert (or how to give plugins a path to those files so they can convert them) and then, save the converted files in another folder.

Thanks for your replies !

Have a look at the conference app example:

So i only need Ionic Native HTTP plugin and RxJS to get it running ?

Not Native HTTP, http is import { Http } from '@angular/http';. But besides this: Yes, reading files locally is easy.

For saving them you will have to use a native thing then of course, but there are multiple for Ionic Native.

So to save my converted files i would then use Ionic Native File plugin ?

For example, yes.

Depending on how big and complex the resulting JSON is you can also store it using Ionic Storage or similar instead of as a file.

It’s rather small, but after the conversion I want to store them in pouchDB where I them will access them for usage.
Thank you so much for the help.

1 Like

If these files are being baked into the app as assets, I would strongly recommend doing whatever conversion is needed in your development environment ahead of time. There’s no need to burden devices with that work.