How to read file? Lools like there is many approaches

It looks like there is a couple of alternatives for working with files…
I did installation for Capacitor from here:

But I didn’t understand an example there… It looks unclear, like class description without name?
And then tried:

import { File } from '@ionic-native/file/ngx'
...
const fileReader = new File() 
const contentText = await fileReader.readAsText(
				'../content',
				'content.vtt'
			)

it causes an error :

./node_modules/@ionic-native/file/ngx/index.js
Module not found: Can't resolve '@angular/core' in '/home/aparus/Projects/vtt-phrasal-player/node_modules/@ionic-native/file/ngx'

Then I saw other approach with

but I didn’t try it yet.

Also I see the third approach?

Please, can someone explain shortly differences between them? Which should I choose, and how to implement it right?

What I want at the end? Some predefined folder, where I can store text files (subtitles) and media files (video, audio). For web, windows, android and iOS.

Well, seeing as how you’re posting in the React subforum, this isn’t going to work. That /ngx at the end of the import path means “Angular”. That’s about all I can say, because I don’t speak React.

1 Like

Thank you! May be you know difference between @ionic-native/file and @capacitor/filesystem? So confusing documentation :frowning: After googling at first appears htmlFileApi, then after hours of tries and it’s not working , you see that there is also other one: capacitor/filesystem. Somewhere people use file/ngx without noticing that it is for Angular. I get headache while reading all of this )))