Skip to content

obsidian/vault

This module provides utility functions for working with the Obsidian Vault.

InterfaceDescription
ContentArgsArguments for process.
CopySafeParamsParameters for copySafe.
GetAbstractFilePathSafeParamsParameters for getAbstractFilePathSafe.
GetOrCreateAbstractFileSafeParamsParameters for getOrCreateAbstractFileSafe.
GetSafeRenamePathParamsParameters for getSafeRenamePath.
InvokeWithFileSystemLockParamsParameters for invokeWithFileSystemLock.
IsChildOrSelfParamsParameters for isChildOrSelf.
IsChildParamsParameters for isChild.
ProcessOptionsOptions for process.
ProcessParamsParameters for process.
RenameSafeParamsParameters for renameSafe.
FunctionDescription
copySafeCopies a file safely in the vault.
createFolderSafeCreates a folder safely in the specified path.
createTempFileCreates a temporary file in the vault with parent folders if needed.
createTempFolderCreates a temporary folder in the vault with parent folders if needed.
deleteEmptyFolderDeletes an empty folder.
deleteEmptyFolderHierarchyRemoves empty folder hierarchy starting from the given folder.
getAbstractFilePathSafeGets a safe path for a file or folder.
getAvailablePathGets an available path for a file in the vault.
getFilePathSafeGets a safe file path for a file or folder.
getFolderPathSafeGets a safe folder path for a file or folder.
getMarkdownFilesSortedRetrieves an array of Markdown files from the app’s vault and sorts them alphabetically by their file path.
getNoteFilesSortedRetrieves an array of all note files from the app’s vault and sorts them alphabetically by their file path.
getOrCreateAbstractFileSafeGets or creates an abstract file safely in the specified path. If the file already exists, it will be returned. If the file does not exist, it will be created and returned.
getOrCreateFileSafeGets or creates a file safely in the specified path. If the file already exists, it will be returned. If the file does not exist, it will be created and returned.
getOrCreateFolderSafeGets or creates a folder safely in the specified path. If the folder already exists, it will be returned. If the folder does not exist, it will be created and returned.
getSafeRenamePathGets a safe rename path for a file.
invokeWithFileSystemLockInvokes a function with the file system lock.
isChildChecks if a path or file is a child of another path or file.
isChildOrSelfChecks if a path or file is a child or self of another path or file.
isEmptyFolderChecks if a folder is empty.
listSafeSafely lists the files and folders at the specified path in the vault.
processProcesses a file with retry logic, updating its content based on a provided value or function.
readSafeReads the content of a file safely from the vault. It covers the case when the file was removed during the reading.
renameSafeRenames a file safely in the vault. If the new path already exists, the file will be renamed to an available path.
saveNoteSaves the specified note in the Obsidian app.
trashSafeTrashes an abstract file safely from the vault.