Skip to content

Instantly share code, notes, and snippets.

@milksense
Created February 11, 2021 11:24
Show Gist options
  • Save milksense/0daca33246802265f08716ce2d6ba29f to your computer and use it in GitHub Desktop.
Save milksense/0daca33246802265f08716ce2d6ba29f to your computer and use it in GitHub Desktop.
File downloading via Vanilla JavaScript
setTimeout(() => {
const a = document.createElement('a');
a.download = 'file.txt';
a.href = 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==';
a.click();
}, 5e3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment