Is it possible to know the name of a file that is being downloaded or to set a name before download?

I'm downloading a ton of files using puppeteer, but I need to know each file's name before or after download is complete. Watching the folder for file change doesn't solve my problem, due to lots of processes downloading files at the same time and having now way to match them.

I've been trying to set a custom path for download for each file, but Puppeteer does something weird that some downloads go to that folder and others to /Downloads.

So, I would like to know if there's a way to know the name before download or to set the name of the file before downloading. This way I can properly match it through code.

Note: files are downloaded via JS i.e. when a button is clicked. No way to know file name via scrapping due to it being auto-generated.