33 lines
974 B
JavaScript
33 lines
974 B
JavaScript
// Module ID: 212
|
|
// Function ID: 213
|
|
// Name: binaryToBase64
|
|
// Dependencies: [206]
|
|
|
|
// Module 212 (binaryToBase64)
|
|
import byteLength from "byteLength" /* 206 */;
|
|
|
|
require = arg1;
|
|
const dependencyMap = arg6;
|
|
arg5.default = function binaryToBase64(arg0) {
|
|
let uint8Array = arg0;
|
|
if (arg0 instanceof ArrayBuffer) {
|
|
const _Uint8Array = Uint8Array;
|
|
uint8Array = new Uint8Array(arg0);
|
|
}
|
|
if (uint8Array instanceof Uint8Array) {
|
|
return byteLength.fromByteArray(uint8Array);
|
|
} 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);
|
|
return byteLength.fromByteArray(uint8Array1);
|
|
} else {
|
|
const _Error = Error;
|
|
error = new Error("data must be ArrayBuffer or typed array");
|
|
throw error;
|
|
}
|
|
}
|
|
};
|