Pull folder from ios device unable to decode base64 zip archive

Hi, I am looking for a way to pull folder from a IOS real device, with the below code

byte[] folder = driver.pullFolder("/path/to/device/foo.bar");

I’m able to get the base64 format from the “folder”, but the problem is I’m unable to convert the received based64 string into a zip archive.

Is there a way to do this with Appium? Or a tool/code exists for the same?