var fileElement= document.querySelector('input[type="file"]');
fileElement.addEventListener('change', function(evt){
var reader= new ChunkdFileReader();
reader.subscribe('begin', function(evt){
console.log('Start reading');
});
reader.subscribe('progress', function(evt){
console.log('Progress ' + evt.done + ' / ' + evt.nchunks + ' chunks (' + (evt.done_ratio * 100).toFixed(2) + '%)');
});
reader.subscribe('chunk', function(evt){
console.log('Read chunk: ' + new Uint8Array(evt.chunk));
});
reader.subscribe('end', function(evt){
console.log('Done reading');
});
reader.readChunks(evt.target.files[0]);
});