Functions run at the server. You have to get that byte array to the client for that prompt. The Epicor preferred way is to write it to one of the EpicorData folders and download it using Server File Download which prompts for a save as location.
If you’re using Kinetic UI, you might be able to leverage the File Picker Component and the file transfer widget.