Open testtomat opened 1 year ago
I found this solution:
use try/catch
function base64ToText(base64String) { try { const binaryString = atob(base64String); const codePoints = Array(binaryString.length); for (let index = 0; index < binaryString.length; index++) codePoints[index] = binaryString.codePointAt(index); const uint8CodePoints = Uint8Array.from(codePoints); return new TextDecoder().decode(uint8CodePoints); catch(e) { return base64String; } }
I found this solution:
use try/catch