title: Capacitor FileSystem API - Unable to write a file on device using Filesystem.writeFile
body: <p>I'm working on a Hybrid app using Angular 9 / Ionic 5 / Capacitor 2.0. I'm trying to save a file (basically PDF or image file) coming from my API as a Blob to the file system of my mobile devices (IOS/Android). My final goal is to reproduce a Browser-like download feature of the file (allowing the user to keep it on his phone).</p>
  <p>Here is my code :</p>
  <pre><code>  downloadNativeFile(blob: Blob, fileName: string){
      let reader = this.getFileReader();
      reader.onloadend = (readerEvent) =&gt; {
        if(reader.error){
          console.log(reader.error);
        } else {
          let base64data: any = readerEvent.target['result'];
          try {
            Filesystem.writeFile({
              path: fileName,
              data: base64data,
              directory: FilesystemDirectory.Data
            }).then((res)=&gt;{
              Filesystem.getUri({
                directory: FilesystemDirectory.Data,
                path: fileName
              }).then((getUriResult) =&gt; {
                const path = getUriResult.uri;
                console.log(&quot;The file's path : &quot; + path);
                console.log(Capacitor.convertFileSrc(getUriResult.uri));              
              }, (error) =&gt; {
                console.log(error);
              });
            }).catch((err)=&gt;{
              console.log(&quot;Error&quot;, err);
            });
          } catch(e) {
            console.error('Unable to write file', e);
          }
        }
      }
  
      reader.readAsDataURL(blob);
    }
  </code></pre>
  <p>Executing this code I don't get any error and my console prints the path of the saved file :</p>
  <pre><code>The file's path : /DATA/sample.pdf
  http://localhost/_capacitor_file_/DATA/sample.pdf
  </code></pre>
  <p>Nevertheless, I can't found any new file on my device (I also tried all values from the FilesystemDirectory enum). Tested on both Android (7 &amp; 10) and IOS (13).</p>
  <p>My Blob is good (I can vizualize it in browser) and the dataUrl conversion is properly done.</p>
  <p>So it seems that the writeFile function from the Capacitor FileSystem API is silently failing to save the file on the device.</p>
  <p>Does anyone know why and how can I fix this ? I'm literally stucked and can't implement this feature at the moment.</p>
  <p>Here are my dependencies and plugins :</p>
  <pre><code>  &quot;dependencies&quot;: {
      &quot;@angular/animations&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/cdk&quot;: &quot;^9.2.3&quot;,
      &quot;@angular/common&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/compiler&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/core&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/fire&quot;: &quot;^5.4.2&quot;,
      &quot;@angular/forms&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/material&quot;: &quot;^9.2.3&quot;,
      &quot;@angular/material-moment-adapter&quot;: &quot;^9.2.4&quot;,
      &quot;@angular/platform-browser&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/platform-server&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/router&quot;: &quot;^9.1.7&quot;,
      &quot;@angular/service-worker&quot;: &quot;^9.1.7&quot;,
      &quot;@auth0/angular-jwt&quot;: &quot;^2.1.0&quot;,
      &quot;@capacitor/android&quot;: &quot;^2.1.0&quot;,
      &quot;@capacitor/core&quot;: &quot;2.1.0&quot;,
      &quot;@capacitor/ios&quot;: &quot;^2.1.0&quot;,
      &quot;@ionic-native/core&quot;: &quot;^5.25.0&quot;,
      &quot;@ionic-native/fcm&quot;: &quot;^5.26.0&quot;,
      &quot;@ionic-native/http&quot;: &quot;^5.26.0&quot;,
      &quot;@ionic-native/splash-screen&quot;: &quot;^5.25.0&quot;,
      &quot;@ionic-native/status-bar&quot;: &quot;^5.25.0&quot;,
      &quot;@ionic/angular&quot;: &quot;^5.1.1&quot;,
      &quot;@ngrx/effects&quot;: &quot;^9.1.2&quot;,
      &quot;@ngrx/entity&quot;: &quot;^9.1.2&quot;,
      &quot;@ngrx/store&quot;: &quot;^9.1.2&quot;,
      &quot;@ngrx/store-devtools&quot;: &quot;^9.1.2&quot;,
      &quot;ajv&quot;: &quot;^6.9.1&quot;,
      &quot;angular2-text-mask&quot;: &quot;^9.0.0&quot;,
      &quot;animate.css&quot;: &quot;^3.7.0&quot;,
      &quot;bootstrap-sass&quot;: &quot;^3.4.0&quot;,
      &quot;capacitor-fcm&quot;: &quot;^2.0.0&quot;,
      &quot;classlist.js&quot;: &quot;^1.1.20150312&quot;,
      &quot;cordova-plugin-advanced-http&quot;: &quot;^2.4.1&quot;,
      &quot;cordova-plugin-file&quot;: &quot;^6.0.2&quot;,
      &quot;core-js&quot;: &quot;^2.6.4&quot;,
      &quot;fibers&quot;: &quot;^4.0.3&quot;,
      &quot;file-saver&quot;: &quot;^2.0.2&quot;,
      &quot;firebase&quot;: &quot;^5.8.2&quot;,
      &quot;font-awesome&quot;: &quot;^4.7.0&quot;,
      &quot;html-webpack-plugin&quot;: &quot;^2.21.0&quot;,
      &quot;jetifier&quot;: &quot;^1.6.6&quot;,
      &quot;lottie-web&quot;: &quot;^5.4.3&quot;,
      &quot;moment&quot;: &quot;^2.24.0&quot;,
      &quot;ngx-markdown&quot;: &quot;^9.0.0&quot;,
      &quot;pwa&quot;: &quot;^1.9.6&quot;,
      &quot;rxjs&quot;: &quot;^6.5.5&quot;,
      &quot;scrolling-element&quot;: &quot;^1.0.2&quot;,
      &quot;tslib&quot;: &quot;^1.10.0&quot;,
      &quot;web-animations-js&quot;: &quot;^2.3.2&quot;,
      &quot;zone.js&quot;: &quot;~0.10.2&quot;
    },
    &quot;devDependencies&quot;: {/**/},
    &quot;cordova&quot;: {
      &quot;plugins&quot;: {
        &quot;cordova-plugin-advanced-http&quot;: {}
      }
    }
  </code></pre>