Export JPEG and get file size in UXP

This will trigger the save process but saving will be done in the background.
Reading metadata right even after doing await on the descriptor will return “no such file or directory” error.

Unfortunately I didn’t yet find a reliable way to save/export to JPG and get file size.
There also seem to be many strange issues with files overall in UXP: How to overwrite a file?