function downloadText(filename, text) { Object.assign(document.createElement('a'), { download: filename, href: 'data:text/plain;charset=utf-8,' + encodeURIComponent(text), }).click() }