Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
//react 0.14.7
saveModel() {
this.downloadFile(JSON.stringify(, null, ' '));
downloadFile(contents) {
var newFileContent = new Blob([contents], {type: 'application/octet-binary'}),
downloadURL = window.URL.createObjectURL(newFileContent),
downloadLink = document.getElementById('file-download-link');
downloadLink.href = downloadURL; = + '.json';;
// Free memory
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.