FileManager

FileManager class

Manage the creation, deletion and renaming of files from the UI.

Signature:

export class FileManager 

Methods

MethodModifiersDescription
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).

6๊ฑด์˜ ํ•ญ๋ชฉ