Capicator FileTransfer Can't Download File (Code:3, http_status:401)

Hi Developers.

I have a problem when downloading a file from a URL with FileTransfer Plugin
I get the error (code: 3) and (http_status:401)
I’m using Ionic 5 Capacitor, Hope to find any solutions
Best Wishes

  const url = '';, this.file.dataDirectory + 'file.pdf').then((entry) => {
            console.log('download complete: ' + entry.toURL());
        }, (error) => {
            // handle error
            console.log('An rrror occurred: ' + error);

The file transfer plugin has been obsoleted for years now. I would use HttpClient instead, but 401 means you have not provided sufficient authorization to access that file. Is that really the error you get from

Thanks, @rapropos

I followed the documentation for FileTransfer as it without any changes.
I want to use FileTransfer Instead of HttpClient, because I want to download a big size json file ( > 15mb ).
and that failed with HttpClient.
So the aim is to make the application download the file on launch and then complete the work offline.
The error from the plugin, I had used many URL for other files and the error is the same

That doesn’t make sense to me, so I’d rather work on that angle instead of bothering further with obsoleted Cordova junk.

I really don’t mean this to sound rude or like I’m attacking you, but I don’t know how else to put it: when you’re asking for help with something, it’s absolutely vital that you report exactly what you are doing and exactly what you’re seeing. You may think that seemingly small subtle changes like swapping out your true URL for “a big size json file (>15MB)” for an unprotected 7KB PDF on a totally different host can’t possibly make a difference, but they really can.

I look at it this way: when I’m in your position, and mystified by something, I do whatever I can to create a small, isolated, reproducible test case. Once I have that, I present that test code, describe what the difference is between what it does and what I expected or wished it would do, and then wait for other people to ask me for additional information. I have to accept the fact that if I knew what was or wasn’t relevant, I wouldn’t be needing to ask for help.

1 Like