Error with write file capacitor FileSystem

What format should write data. In base64 works horribly, today it writes, tomorrow not, some files refuses to write down at all, although through the web version all works perfectly. Are there any analogues?

 let reader = new FileReader();
    reader.onloadend = async function () {
      const base64data = reader.result;
        const result = await Filesystem.writeFile({
          path: name,
          data: base64data,
          directory: Directory.Documents,

Error image: