How does js simulate the download function of audio tags?

audio there is a download function when opens controls , you can export audio files by clicking the download button, but can be triggered by js?
recently, when I was reading a novel, I suddenly thought that it was a bit inconvenient to move while reading a novel. It would be more convenient to change the novel into audio. Although there is an app function to achieve reading aloud, it still has some limitations. I thought of writing a web version of TTS, https://codepen.io/starrysky_.
after writing demo. Audio has the function of interface operation to export audio, but how to achieve it through js?
1 request backend through ajax to obtain audio files, which is simple, rude and convenient. It is feasible
2 js to trigger audio download event (it seems that this event has not been exposed, W3C is not found, and books are not found), and it is doubtful

.

choose between two options, if 2 is possible, individuals prefer 2, and the logic is more concise
. Besides, is there any other for ?

Menu