I need some help returning the "bytes" variable from this function below to be used as input in another function.
function openfile() {
var input = document.getElementById("files").files;
var fileData = new Blob([input[0]]);
var reader = new FileReader();
reader.readAsArrayBuffer(fileData);
reader.onload = function(){
var arrayBuffer = reader.result
var bytes = new Uint8Array(arrayBuffer);
console.log(bytes);
}
I'd like to get the return of the above function and use the array of bytes as input parameter in another function.
return bytes;? To use it as a parameter for another function, use it like this:myfunction(openfile(evt));