Binary converter
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Binary Data to Uint8Array Converter</title>
</head>
<body>
<label for="binaryInput">Enter Base64-encoded binary data:</label>
<textarea id="binaryInput" rows="10" cols="40">
0
:
255
1
:
251
2
:
144
3
:
196
4
:
0
5
:
0
6
:
14
7
:
37
8
:
141
9
:
43
10
:
161
11
:
136
12
:
98
13
:
170
14
:
153
15
:
179
16
:
35
17
:
249
18
:
134
19
:
26
20
:
48
21
:
25
22
:
180
23
:
156
24
:
36
25
:
150
26
:
154
27
:
81
28
:
186
29
:
16
30
:
131
31
:
187
32
:
128
33
:
8
34
:
0
35
:
128
36
:
8
37
:
36
38
:
66
39
:
160
40
:
113
41
:
221
42
:
197
43
:
176
44
:
1
45
:
60
46
:
3
47
:
127
48
:
129
49
:
0
50
:
19
51
:
210
52
:
187
53
:
139
54
:
58
55
:
232
56
:
133
57
:
162
58
:
34
59
:
110
60
:
238
61
:
238
62
:
238
63
:
231
64
:
255
65
:
241
66
:
17
67
:
221
68
:
220
69
:
56
70
:
183
71
:
220
72
:
66
73
:
33
74
:
113
75
:
17
76
:
29
77
:
222
78
:
187
79
:
187
80
:
139
81
:
68
82
:
43
83
:
2
84
:
39
85
:
5
86
:
155
87
:
187
88
:
135
89
:
3
90
:
122
91
:
128
92
:
8
93
:
94
94
:
137
95
:
187
96
:
187
97
:
159
98
:
67
99
:
139
</textarea>
<br>
<button onclick="convertBinaryData()">Convert</button>
<br>
<label for="output">Resulting Uint8Array:</label>
<textarea id="output" rows="10" cols="40" readonly></textarea>
<script>
function convertBinaryData() {
const binaryInput = document.getElementById('binaryInput').value.trim();
// Convert Base64 to Uint8Array
const binaryArray = parseBinaryInput(binaryInput);
// Display the result
document.getElementById('output').value = JSON.stringify([...binaryArray]);
}
function parseBinaryInput(input) {
const lines = input.split('\n');
const uint8Array = new Uint8Array(lines.length);
for (let i = 0; i < lines.length; i++) {
...