Ionic 3 Native : File : {code: 5, message: "ENCODING_ERR"}

In my case, I let "File:///" in the route and now it is working.


After looking through similar cases, I've found no solution nor documentation about this specific case. But while experimenting with different values, I found what caused this error : :. Yes, the colon. The one present in the file name.

While I still have no explanation about why : causes the native File plugin to fail but not the web view, removing : from the file name effectively allows File to see it without raising an ENCODING_ERR. While this is not an optimal solution, this workaround is effective.


None of the answers solve my problem. It was very simple, I was using the wrong Directory to save a file in iOS. I was using "Cache" but kept getting the error

I change to

this.file.tempDirectory;

And worked!