This approach will create text data on the fly and then use JavaScript to create a text file and then download it. Attach an event listener looking for a click to a download button. In this approach, we will use the Axios library to download files. Blob stands for Binary Large Object and is a data type that can store binary data.
This method is not restricted to the plain text entered by the user like the previous method. We can request any sort of data from an API and then use this approach to save data inside our computer.
Table of Contents. Save Article. Improve Article. Like Article. How to trigger a file download when. Welcome to GeeksforGeeks. Download Image. By clicking the download button. If you want to save a web page as a text document, and preserve the HTML code that provides formatting of the text, follow the steps below. Copy and paste web page text in a text document. Note Microsoft Word must be installed on your computer to utilize the steps below. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 7 years, 5 months ago. Active 7 years, 5 months ago. Viewed 16k times. Improve this question. CodingIntrigue NET to do the same. MerlinRajaselvi Even a server can't write arbitrary files to a user's computer. But it's certainly possible to generate a file and trigger the download prompt where the user can decide if and where to save the file.
0コメント