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 the plugin change what's there, if it hasfiles:write. With onlyfiles:read, it can read what's there and nothing more.pickFilegives the plugin one file, to read it or, withsave: true, to write it.
Reading and writing (paths are full paths):
readreturns bytes, up to 100 MB.readTextreturns text.write(path, text or bytes)creates any missing folders on the way.list,statandmkdirdo what their names say.trashmoves a file to the system's trash, where the writer can get it back.
Bläck Studio checks every path in the main process, including any links. A link inside a chosen folder that leads outside it leads nowhere. Bläck Studio remembers what the writer chose until they take it back in Settings → Plugins, or turn the plugin off. granted() lists these choices.
temp() gives the plugin a private folder among Bläck Studio's data, which only the writer's account can open. The plugin can always use it, with any files: or exec: permission, for passing files to a program.