| asArrayOfFiles | Converts an array of abstract files to an array of files. |
| asArrayOfFolders | Converts an array of abstract files to an array of folders. |
| asFile | Converts an abstract file to a file. |
| asFileOrNull | Converts an abstract file to a file or null. |
| asFolder | Converts an abstract file to a folder. |
| asFolderOrNull | Converts an abstract file to a folder or null. |
| checkExtension | Checks if the given path or file has the specified extension. |
| doesExist | Checks if the given path exists. |
| getAbstractFile | Retrieves the TAbstractFile object for the given path or abstract file. |
| getAbstractFileOrNull | Retrieves an abstract file or null based on the provided path or abstract file. |
| getBasename | Returns the base name of the given pathOrFile: a file’s name without its extension, a folder’s full name. Unlike basename from path.ts, which is a pure string function, this resolves the argument against the vault first. That is what lets a folder whose name contains a dot answer with its whole name instead of a bogus extension split, and it is why a caller handling both kinds no longer has to branch on isFile itself — a folder has no basename of its own. A path that resolves to nothing has no answer to look up, so GetBasenameParams.whenMissingTreatAs decides what happens. It defaults to MissingPathTreatment.Throw rather than to a guess: alpha.bravo may name a dotted folder or a .bravo file, and nothing in the vault says which, so a silently wrong answer is worse than an error. Pass MissingPathTreatment.File for the checkExtension reading of a bare string, or MissingPathTreatment.Folder for the other one. |
| getExtension | Returns the extension of the given pathOrFile: a file’s extension without the leading dot, and an empty string for a folder. Unlike extname from path.ts, which is a pure string function, this resolves the argument against the vault first, so a folder whose name contains a dot answers with an empty string rather than a bogus extension. A folder has no extension of its own, which is why a caller handling both kinds would otherwise branch on isFile itself. A path that resolves to nothing has no answer to look up, so GetExtensionParams.whenMissingTreatAs decides what happens. It defaults to MissingPathTreatment.Throw rather than to a guess: alpha.bravo may name a dotted folder or a .bravo file, and nothing in the vault says which, so a silently wrong answer is worse than an error. Pass MissingPathTreatment.File for the checkExtension reading of a bare string, or MissingPathTreatment.Folder for the other one. |
| getFile | Retrieves a file based on the provided path or file. |
| getFileOrNull | Retrieves a file or null based on the provided path or file. If the provided argument is already a file, it is returned as is. Otherwise, the function uses the app’s vault to retrieve the file by its path. |
| getFileSystemType | Gets the type of a file system object. |
| getFolder | Retrieves a folder based on the provided app and pathOrFolder. |
| getFolderOrNull | Retrieves a folder or null based on the provided path or folder. |
| getMarkdownFiles | Retrieves an array of files representing the markdown files within a specified folder or path. |
| getOrCreateFile | Retrieves the file for the given path or creates a new one if it does not exist. |
| getOrCreateFolder | Retrieves the folder for the given path or creates a new one if it does not exist. |
| getPath | Returns the path of the given pathOrFile. |
| isAbstractFile | Checks if the given file is an instance of abstract file. |
| isBaseFile | Checks if the given file is a base file. |
| isCanvasFile | Checks if the given file is a canvas file. |
| isFile | Checks if the given file is an instance of file. |
| isFolder | Checks if the given file is a folder. |
| isMarkdownFile | Checks if the given file is a Markdown file. |
| isNote | Checks if the given file is a note. |
| isTreatedAsAttachment | Checks if the given file should be treated as an attachment because of its extension. Some plugins store their data in files that are markdown on disk but are not prose — Excalidraw, for example, saves each drawing as sketch.excalidraw.md. Obsidian reports such a file’s extension as md, so a caller that wants to tell a drawing apart from a note has to match the full multi-part extension (.excalidraw.md) against the file name. Which extensions count is the caller’s configuration, not this library’s — only the matching rule is shared. |
| trimMarkdownExtension | Trims the markdown extension from the file path if the file is a markdown file. If the file is not a markdown file, the original file path is returned. |