function bigIntToBase64(value) { const base = 64n; const digits = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&#"; const sign = value < 0n ? "-" : ""; let [result, quotient] = ["", sign ? 0n - this : this]; do { result = `${digits[Number(quotient % base)]}${result}`; } while (quotient /= base); return `${sign}${result}`; }