Write mp3 from url to system

I’ve been at this for too long, and can’t get it to work at all. I tried a lot of different things too.

How am I supposed to write an mp3 from a download prompt (from an api) to the file system?

    constructor(private transfer: FileTransfer, private platform: Platform, private file: File) {
        platform.ready().then(() => {
            if (platform.is('android')) this.fileLocation = file.documentsDirectory;
            else this.fileLocation = file.dataDirectory;


    fileLocation: string;

    download(id: string) {   
        const fileTransfer : FileTransferObject = this.transfer.create();
        fileTransfer.download(`https://api.com/get/audio/${id}`, this.fileLocation).then(entry => {
        }).catch(err => console.log(err));