November 2019
Beginner
436 pages
8h 52m
English
In this section, we are going to provide support for saving files. Similar to the Open file functionality, web developers need to perform some easy workarounds to invoke the file download feature from the code.
The most popular way to do this is to dynamically create an invisible hyperlink element with the download attribute set to the filename and then invoke a click. This is what we are going to implement for our project. Follow these steps to get started:
const saveFile = contents => { const blob = new Blob([contents], { type: 'octet/stream' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); ...Read now
Unlock full access