赞
踩
- let url = ‘http:.....’//音频文件的url
- let filename = '音频文件'
- fetch(url)
- .then(response => response.arrayBuffer())
- .then(wavData => {
- const blob = new Blob([wavData], { type: 'audio/wav' });
- const downloadUrl = URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = downloadUrl;
- link.download = filename;
- // 模拟点击链接进行下载
- link.click();
- // 清理临时链接
- URL.revokeObjectURL(downloadUrl);
- });
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。