JSFiddle - React, Tailwind, and code Playground

HTML

<input type='text' id='input' value='10000'>
Characters
<button onclick="tryDataURI()">Test DATA URI</button>

JavaScript

String.prototype.repeat = function(num) {
  return new Array( num + 1 ).join( this );
}

testDataURI=function(size) {
  var link = document.createElement("a");
  var encodedUri = encodeURI("data:text/plain,"+"a".repeat(size-16))
  link.setAttribute("href", encodedUri);
  link.setAttribute("download", "test_" + new Date().toJSON() + ".txt");
  document.body.appendChild(link); 
  link.click()
}

testDataURI(2097152);