decord/source/212_binaryToBase64.js

34 lines
974 B
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 212
2026-07-29 08:29:29 +00:00
// Function ID: 213
2026-07-20 16:05:17 +00:00
// Name: binaryToBase64
2026-07-23 10:11:24 +00:00
// Dependencies: [206]
2026-07-20 16:05:17 +00:00
// Module 212 (binaryToBase64)
2026-08-24 06:08:38 +00:00
import byteLength from "byteLength" /* 206 */;
require = arg1;
2026-07-23 10:11:24 +00:00
const dependencyMap = arg6;
2026-07-20 16:05:17 +00:00
arg5.default = function binaryToBase64(arg0) {
let uint8Array = arg0;
if (arg0 instanceof ArrayBuffer) {
const _Uint8Array = Uint8Array;
uint8Array = new Uint8Array(arg0);
}
if (uint8Array instanceof Uint8Array) {
2026-08-24 06:08:38 +00:00
return byteLength.fromByteArray(uint8Array);
2026-07-20 16:05:17 +00:00
} else {
const _ArrayBuffer = ArrayBuffer;
if (ArrayBuffer.isView(uint8Array)) {
const buffer = uint8Array.buffer;
({ byteOffset, byteLength } = uint8Array);
const _Uint8Array2 = Uint8Array;
const uint8Array1 = new Uint8Array(buffer, byteOffset, byteLength);
2026-08-24 06:08:38 +00:00
return byteLength.fromByteArray(uint8Array1);
2026-07-20 16:05:17 +00:00
} else {
const _Error = Error;
2026-08-24 06:08:38 +00:00
error = new Error("data must be ArrayBuffer or typed array");
2026-07-20 16:05:17 +00:00
throw error;
}
}
};