Source Code:
(back to article)
Submit
Result:
Report an issue
<input type="file" id="binaryInput" /> <div id="binaryOutput">Select anyfile.</div> <script> document.getElementById('binaryInput').addEventListener('change', async function(event) { const file = event.target.files[0]; const reader = new FileReader(); reader.onload = function(e) { const buffer = e.target.result; // Process the binary data const info = `Buffer Length: ${buffer.byteLength} bytes`; document.getElementById('binaryOutput').innerHTML = info; }; reader.readAsArrayBuffer(file); }); </script>