How to download file with javascript?

前端 未结 3 820
南笙
南笙 2021-01-12 13:44

I want to be able to download a given file when pressing a button.The file will be provided via an API call.For now, I will have it in my local storage. So my f

3条回答
  •  耶瑟儿~
    2021-01-12 14:46

    You can do it via HTML , but if you have to do it in JS there is https://github.com/eligrey/FileSaver.js/ library.

提交回复
热议问题