FileSystem.WriteFile returns undefined

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.

    async next(base64: Base64Data){
const savedFile = await Filesystem.writeFile({

         path: base64.Name,

         data: base64.Data,

         directory: Directory.Data,