Does Capacitor writeFIle only write strings to txt files?

I am trying to write a pdf to file on an android device with data either as blob or base64 but the Capacitor writeFile only seems to accept a string as data and creates a text document.
When I gave it a base64 string it just dumped it into the file as text.

Is there any way to write a file using blob or base64 or will I have to give up and convert my project back to Cordova?

https://capacitor.ionicframework.com/docs/apis/filesystem

Linked with: https://forum.ionicframework.com/t/capacitor-writefile-saving-pdf-file-is-in-invalid-format

Solved:
Remove the encoding parameter.
See: