1 Star 1 Fork 0

masx200 / deno-dns-over-https-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
base64Encode.tsx 544 Bytes
一键复制 编辑 原始数据 按行查看 历史
masx200 提交于 2024-02-21 16:24 . runCommand
/**
* 将给定的Uint8Array类型的数据进行Base64编码
* @param byteArray - 要进行编码的Uint8Array类型的数据
* @returns 编码后的Base64字符串
*/
export function base64Encode(byteArray: Uint8Array): string {
const buffer = new Uint8Array(byteArray);
const binaryString = buffer.reduce(
(str, byte) => str + String.fromCharCode(byte),
"",
);
const encoded = btoa(binaryString)
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=/g, "");
return encoded;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/masx200/deno-dns-over-https-server.git
git@gitee.com:masx200/deno-dns-over-https-server.git
masx200
deno-dns-over-https-server
deno-dns-over-https-server
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891