FileManager class
Manage the creation, deletion and renaming of files from the UI.
Signature:
export class FileManager
Methods
Method | Modifiers | Description |
---|---|---|
generateMarkdownLink(file, sourcePath, subpath, alias) | Generate a Markdown link based on the user’s preferences. | |
getAvailablePathForAttachment(filename, sourcePath) | Resolves a unique path for the attachment file being saved. Ensures that the parent directory exists and dedupes the filename if the destination filename already exists. | |
getNewFileParent(sourcePath, newFilePath) | Gets the folder that new files should be saved to, given the user’s preferences. | |
processFrontMatter(file, fn, options) | Atomically read, modify, and save the frontmatter of a note. The frontmatter is passed in as a JS object, and should be mutated directly to achieve the desired result. Remember to handle errors thrown by this method. | |
renameFile(file, newPath) | Rename or move a file safely, and update all links to it depending on the user’s preferences. | |
trashFile(file) | Remove a file or a folder from the vault according the user’s preferred ‘trash’ options (either moving the file to .trash/ or the OS trash bin). |