Saving files like video, image, pdf, txt to local storage

In my application I download some files from my back-end and I want to save it to the application storage. The files must not be deleted if I close the app. I will use the files to play them in my application at specific. How to save the downloaded file to app storage?

Downloading files from an app to the TV is not supported. Sorry for not being helpful.

I was able to download. I stored it using indexed db.