mirror of
https://github.com/ZSCGR/CloudFlare-ImgBed.git
synced 2026-08-22 08:33:42 +08:00
12 lines
283 B
TypeScript
12 lines
283 B
TypeScript
export function hexFromBytes(arr: Uint8Array): string {
|
|
if (globalThis.Buffer) {
|
|
return globalThis.Buffer.from(arr).toString("hex");
|
|
} else {
|
|
const bin: string[] = [];
|
|
arr.forEach((byte) => {
|
|
bin.push(byte.toString(16).padStart(2, "0"));
|
|
});
|
|
return bin.join("");
|
|
}
|
|
}
|