document.querySelector('input').files will return a FileList object, like explained above, and using [0] we get the first file loaded, and we can access all the properties we need from the File object:document.querySelector('input').addEventListener('change', () => { const file = ...