Files and folders
With files:read or files:write, a plugin can use what the writer chooses for it, in the system's own dialog (its title starts with the plugin's name), and nothing else:
const folder = await this.app.files.pickFolder({ write: true, title: 'Where should the notes go?' })
if (!folder) return // cancelled
await this.app.files.write(`${folder}/notes.md`, '# Notes\n')
for (const entry of await this.app.files.list(folder)) console.log(entry.name, entry.folder, entry.size)
const file = await this.app.files.pickFile({ extensions: ['csv'] }) // one file, to read
const target = await this.app.files.pickFile({ save: true, name: 'cast.csv' }) // where to save oneChoosing:
pickFoldergives the plugin a folder and everything in it.write: truelets it change what's there, if it hasfiles:write; with onlyfiles:read, it reads what's there and nothing more.pickFilegives it one file: to read, or withsave: trueto write.
Reading and writing (paths are full paths):
readreturns bytes, up to 100 MB;readTextreturns text.write(path, text or bytes)makes the folders on the way if need be.list,statandmkdirdo what they say.trashmoves a file to the system's trash, where the writer can get it back.
Every path is checked in the main process, through any links: a link in a chosen folder that leads out of it leads nowhere. What the writer chose is kept until they take it back in Settings → Plugins, or turn the plugin off. granted() lists it.
temp() gives the plugin a folder of its own among Bläck Studio's data, that only the writer's account can open. It's always the plugin's to use, with any files: or exec: permission, for passing files to a program.