Approach to download files through POST request
Have you tried something like:

iframe.addEventListener('loadend', function() {
  document.body.removeChild(iframe);
});


The iframe has many other events (load, error, abort, progress) which might also be useful.