[英]How to download files from storage
I have files in my firebase storage.我的 firebase 存储中有文件。 I want to be able to download a file button click.
我希望能够下载文件按钮单击。
For instance例如
<button (click)="download()"></button>
And component class :和组件类:
download(){
const file_url = 'audio/7ejhsjd';
// Change file name
//download file
}
I would like to change the filename (metadata) of file then download it.我想更改文件的文件名(元数据)然后下载它。
How can I achieve this in JavaScript or TypeScript?如何在 JavaScript 或 TypeScript 中实现这一点?
function download(){ const file_url = 'https://www.google.com.ua/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png'; var el = document.createElement('a'); el.download = file_url; el.href = file_url; document.body.appendChild(el); el.click(); el.remove(); }
<body> <button onclick="download()">Download!</button> </body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.