getFileFromUser(type) {
    return new Promise(resolve => {
      const uploader = document.createElement('input')

      uploader.type = 'file'
      uploader.accept = type

      uploader.addEventListener('change', () => {
        const file = uploader.files[0]
        resolve(file)
      })

      uploader.click()
    })
  }
Note: if user press Cancel in file choosing dialog
it will be an unsettled promise. But it's grabbed by
the garbage collector (tested with FinalizationRegistry).