# FileSystem.WriteFile returns undefined

**URL:** <https://forum.ionicframework.com/t/filesystem-writefile-returns-undefined/221610>\
**Category:** Capacitor\
**Created:** [March 22, 2022, 9:31am UTC](https://forum.ionicframework.com/t/filesystem-writefile-returns-undefined/221610 "2022-03-22T09:31:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SIPHO-0](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@SIPHO-0](https://forum.ionicframework.com/u/SIPHO-0)\
**Post date:** [March 22, 2022, 9:31am UTC](https://forum.ionicframework.com/t/filesystem-writefile-returns-undefined/221610/1 "2022-03-22T09:31:57Z")

</div>

I am trying to download files using the filesystem API to my local storage, the data is converted to base64 from the back-end… From the console log I can see the base64 Data, the problem is that WriteFile returns “Undefined”. I am fairly new in programming your help will be appreciated.

```auto
this.content.downloadNative(this.file.publicId).subscribe({
    async next(base64: Base64Data){
      try{
const savedFile = await Filesystem.writeFile({

         path: base64.Name,

         data: base64.Data,

         directory: Directory.Data,

       })
console.log(savedFile);

```
