editing MySQL binary fiellds

This commit is contained in:
Jan Prochazka
2021-10-17 10:52:10 +02:00
parent 2231bc21cd
commit 5bb9f181d8
5 changed files with 35 additions and 9 deletions

View File

@@ -1,3 +1,12 @@
export function toHexString(byteArray) {
export function arrayToHexString(byteArray) {
return byteArray.reduce((output, elem) => output + ('0' + elem.toString(16)).slice(-2), '');
}
export function hexStringToArray(inputString) {
var hex = inputString.toString();
var res = [];
for (var n = 0; n < hex.length; n += 2) {
res.push(parseInt(hex.substr(n, 2), 16));
}
return res;
}