1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00
Oinktube/node_modules/mux.js/test/base64-to-uint8-array.js
Daniel 2a9630258f https://github.com/WWBN/AVideo/issues/6345#issuecomment-1067056556
Also check the lang in case insensitive
2022-03-14 14:28:38 -03:00

17 lines
478 B
JavaScript

var window = require('global/window');
// TODO: use vhs-utils here
var atob = (s) => window.atob ? window.atob(s) : Buffer.from(s, 'base64').toString('binary');
var base64ToUint8Array = function(base64) {
var decoded = atob(base64);
var uint8Array = new Uint8Array(new ArrayBuffer(decoded.length));
for (var i = 0; i < decoded.length; i++) {
uint8Array[i] = decoded.charCodeAt(i);
}
return uint8Array;
};
module.exports = base64ToUint8Array;