system.file.saveFile not available

Hi, I’ve noticed that system.file.saveFile isn’t available on perspective.
Is this a bug?

The scope of system.file.saveFile is Vision, which means that it is not available to Perspective. This is because the Vision usage of saveFile saves a file to the local system. The Perspective Session does not have the file in use locally (everything is on the Gateway and just displayed locally). You would need to download the file in use. If you can clarify the use-case I could probably walk you through how to implement it. You should look at system.perspective.download()

2 Likes

Pedantic note - despite the name, saveFile doesn’t actually save a file at all (something that’s impossible for webpages to do due to browser security) - instead it opens a local file picker (also impossible in browsers) allowing you to choose a location to save a file, which you would then (in Vision) pass to system.file.writeFile or a similar function.

Browsers don’t allow you to do things with arbitrary filesystem locations - only initiate a download with the user - which, per their browser sessions, may automatically download, or prompt the user to confirm, or go to a specific location, or any number of other things.