{"ScriptPreparationCode":"var unicodeString = \u0022\uAC00\uB098\uB2E4\uB77C\uB9C8\uBC14\uC0AC\uC544\uC790\uCC28\uCE74\uD0C0\uD30C\uD558\u0022;\r\nvar unicodeString_large = \u0022\u0022.padStart(30000, unicodeString);\r\nvar textEncoder = new TextEncoder();\r\n\r\nconst PREFIX_STR = \u0022data:text/plain;base64,\u0022;\r\n\r\nfunction toBase64FileReader( text ) {\r\n return new Promise( (resolve, reject) =\u003E {\r\n const reader = new FileReader();\r\n \r\n // data:text/plain;base64,...\r\n reader.onload = () =\u003E resolve(reader.result.substr(PREFIX_STR.length));\r\n reader.onerror = (err) =\u003E reject(err);\r\n \r\n reader.readAsDataURL(\r\n new Blob([ new TextEncoder().encode( text ) ], { type: \u0022text/plain\u0022 })\r\n );\r\n });\r\n}\r\n\r\nfunction toBase64TextEcnder( text ) {\r\n return btoa( String.fromCharCode(...textEncoder.encode(text)));\r\n}\r\n\r\nfunction toBase64Unscape( text ) {\r\n return btoa(unescape(encodeURIComponent(text)));\r\n}","TestCases":[{"Name":"TextEncoder small (14 chars)","Code":"toBase64TextEcnder(unicodeString);","IsDeferred":false},{"Name":"unescape small (14 chars)","Code":"toBase64Unscape(unicodeString);","IsDeferred":false},{"Name":"FileReader small (14 chars)","Code":"toBase64FileReader(unicodeString);","IsDeferred":false},{"Name":"TextEncoder large (30,000 chars)","Code":"toBase64TextEcnder(unicodeString_large);","IsDeferred":false},{"Name":"unescape large (30,000 chars)","Code":"toBase64Unscape(unicodeString_large);","IsDeferred":false},{"Name":"FileReader large (30,000 chars)","Code":"toBase64FileReader(unicodeString_large);","IsDeferred":false}]}