Created
June 29, 2021 13:07
-
-
Save SuddenlyHazel/bb3474824e029bd776bf9cc448f05933 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var reader = new FileReader() | |
var fileByteArray = [] | |
reader.readAsArrayBuffer(file) | |
reader.onloadend = function (evt) { | |
if (evt.target.readyState == FileReader.DONE) { | |
var arrayBuffer = evt.target.result, | |
array = new Uint8Array(arrayBuffer) | |
for (var i = 0; i < array.length; i++) { | |
fileByteArray.push(array[i]) | |
} | |
console.log("Yay bytes! ", fileByteArray) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment