简体   繁体   English

如何从存储下载文件

[英]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.

相关问题 如何将文件从谷歌云存储下载到用户电脑(React) - How to download files from google cloud storage to user pc (React) 如何从 Firebase 存储下载整个文件夹? - How to download entire folder from Firebase Storage? 用于从 Azure blob 存储下载文件的 javascript 代码 - javascript code to download files from Azure blob storage Laravel 9 和 Javascript:如何下载从 Storage::download() 返回的文件 - Laravel 9 and Javascript: how to download a file returned from Storage::download() Reactjs 如何从 Azure 存储容器下载文件 - Reactjs How to download file from Azure Storage Container 如何从 firebase 存储自动下载文件,而不是使用 url - Javascript - How to download a file from firebase storage automaticly and not with the url - Javascript 如何从firebase存储中获取所有下载URL? - How to get all download url from firebase storage? 如何从 Cloud Storage [Firebase 托管] 下载文件 - How to download file from Cloud Storage [Firebase Hosting] 如何在 React js 中从 firebase 存储下载文件? - How can I download a file from firebase storage in react js? 如何从 Vue Web 应用程序中的 firebase 存储下载文件? - How to download a file from firebase storage in a Vue web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM