I want to download a file from my rest and save it on download folder

I’m using Ionic 4 and I can’t make file-transfer plugin work. I’m desperate. I don’t know what to do or what to try. If anyone could guide me I would appreciate it.

File-transfer was sunsetted years ago. Just use Angular’s HttpClient. It can return Blobs or ArrayBuffers that you can write to a file.

1 Like

I did it but when I install my apk it didn’t work, just works on browser so, I thought to when user clicks on button open a web page on my browser and I installed InAppBrowser plugin but I don’t know how to attach my bearer token in http header. Is there anyway to do it? Because now anyone can download the files.

Virtually every time somebody posts this here, it’s because they are using HTTP, not HTTPS endpoints. Is this true of you as well? If so, does your problem persist when using HTTPS?

I’m using https but i have a middleware to check if session token is active, so i don’t know how to send that token using that plugin.

Interceptors are the easiest way, assuming we’re still using Angular HttpClient.

By “that plugin” I hope you don’t mean the file-transfer one, because I thought we’d agreed to forget it ever existed.

by “that pluggin” I mean (https://ionicframework.com/docs/native/in-app-browser) to open a tab in my browser.

Well, that was an unexpected sharp turn. Somebody else is going to have to help you with InAppBrowser - just reading all the threads here about it gives me migraines.