The project's folder
A plugin that asks for "project:folder" can read and change every file in the open project's folder, including hidden ones such as a version history, and nothing outside it. The writer is told exactly that when asked to allow it. It works the same on a computer and a phone, sandboxed or in the window, and needs "apiVersion": 10.
const here = await this.app.folder.current() // { key, name, book: 'books/<id>' }, or null
const bytes = await this.app.folder.read(here.key, 'project.json') // null if it isn't there
await this.app.folder.write(here.key, 'notes/today.txt', 'Hello')- Paths are relative to the project's folder and use
/as the separator. A path is refused if it's absolute, contains.., goes through a symbolic link, or names.sync(at any level) or.git(below the top level). - Each call names the project by its key, not by a path, so work started on one project can't end up in the next one opened. A key stops working two minutes after its project closes.
folder.arrived(key, paths)tells the app that files were changed from outside it: they're marked as downloaded, and the open book reloads them.folder.create(title, name)asks the writer where to create a new project, for a plugin that brings one in from elsewhere, andproject.open(key)opens it.