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/lib/utils/string.js
2023-06-30 09:56:13 -03:00

20 lines
500 B
JavaScript

/**
* Returns the first string in the data array ending with a null char '\0'
* @param {UInt8} data
* @returns the string with the null char
*/
var uint8ToCString = function(data) {
var index = 0;
var curChar = String.fromCharCode(data[index]);
var retString = '';
while (curChar !== '\0') {
retString += curChar;
index++;
curChar = String.fromCharCode(data[index]);
}
// Add nullChar
retString += curChar;
return retString;
};
module.exports = { uint8ToCString };