Skip to content

Instantly share code, notes, and snippets.

@donatj
Created March 21, 2022 03:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donatj/349eff227295be423886e5bcc334caa8 to your computer and use it in GitHub Desktop.
Save donatj/349eff227295be423886e5bcc334caa8 to your computer and use it in GitHub Desktop.
Read File Inputs from JS (used in https://donatstudios.com/Read-User-Files-With-Go-WASM)
fileInput.addEventListener('input', function(){
fileInput.files[0].arrayBuffer().then(function(x){
const data = new Uint8Array(x[0]);
// send the data to Go (it only accepts bytes as Uint8Array's
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment