Last active
May 13, 2019 16:49
-
-
Save gladchinda/3edcd1b9443dbdc9def9cf4bfe82aae6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Blob object for the content to be download | |
const blob = new Blob( | |
[ /* CSV string content here */ ], | |
{ type: 'text/csv' } | |
); | |
// Create a download link for the blob content | |
const downloadLink = downloadBlob(blob, 'records.csv'); | |
// Set the title and classnames of the link | |
downloadLink.title = 'Export Records as CSV'; | |
downloadLink.classList.add('btn-link', 'download-link'); | |
// Set the text content of the download link | |
downloadLink.textContent = 'Export Records'; | |
// Attach the link to the DOM | |
document.body.appendChild(downloadLink); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment