Skip to content

Instantly share code, notes, and snippets.

@ukyo
Last active December 16, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ukyo/5494035 to your computer and use it in GitHub Desktop.
Save ukyo/5494035 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<title>fileio</title>
</head>
<body>
<input type="file">
<script src="file.js"></script>
<script>
window.onload = function() {
var fileInput = document.querySelector('input');
fileInput.addEventListener('change', function(e) {
var file = e.target.files[0];
var reader = new FileReader;
reader.readAsArrayBuffer(file);
reader.onload = function() {
console.log(fileio(reader.result));
};
}, false);
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment