How to clear local files downloaded by exportDisplay method

I use the exportDisplay method to view PDF files in my fileStorage.
So files are downloaded to the user’s download folder and will build up over a period of time.

I have noticed that if the download file already exists, it adds a sequential number to the filename and download. e.g. file(1).pdf, file(2).pdf, etc

Is there a way to prevent files from being downloaded to user’s local disk ?
Is there a way to overwrite existing files when using the exportDisplay method ?
IS there a way to automatically clear files in the user’s local folder after a while ?

Thanks, I need the help


The cuba.web.viewFileExtensions property defines a list of file extensions displayed in the browser when downloading the file using In other words, this property defines which files to open in a new browser tab to display them rather than download them.

No, files are downloaded by a browser.

No, the app cannot access the user’s file system for security reasons.