Skip to content

DataAdapterEx

Unofficial

Common members for obsidian#CapacitorAdapter and obsidian#FileSystemAdapter.

Import:

import type { DataAdapterEx } from '@obsidian-typings/obsidian-catalyst-latest';

Signature:

export interface DataAdapterEx extends DataAdapter, PromisedQueue

Extends: DataAdapter, PromisedQueue

Properties

Property Type Description
basePath string Base OS path for the vault (e.g. /home/user/vault, or C:\Users\user\documents\vault).
files DataAdapterFilesRecord Mapping of file/folder path to vault entry, includes non-MD files.
handler FileSystemWatchHandler | null Handles vault events.
insensitive boolean Whether the file system is case-insensitive.
promise Promise<unknown> The current promise in the queue chain.
(Inherited from PromisedQueue)
trigger FileSystemWatchHandler Triggers handler for vault events.

Methods

Method Returns Description
_exists(fullPath, sensitive?) Promise<boolean> Check if a file exists.
append(normalizedPath, data, options?) Promise<void> Add text to the end of a plaintext file.
(Inherited from DataAdapter)
appendBinary(normalizedPath, data, options?) Promise<void> Add data to the end of a binary file.
(Inherited from DataAdapter)
copy(normalizedPath, normalizedNewPath) Promise<void> Create a copy of a file. This will fail if there is already a file at normalizedNewPath.
(Inherited from DataAdapter)
exists(normalizedPath, sensitive?) Promise<boolean> Check if something exists at the given path. For a faster way to synchronously check if a note or attachment is in the vault, use Vault.getAbstractFileByPath.
(Inherited from DataAdapter)
getFullPath(path) string Get canonical full path of file.
getFullRealPath(normalizedPath) string Get canonical full path of file.
getName() string Gets the name of the vault.
(Inherited from DataAdapter)
getRealPath(path) string Get normalized path.

For vault-relative path, it's normalized vault-relative path. For absolute path, it's path as is.
getResourcePath(normalizedPath) string Returns a URI for the browser engine to use, for example to embed an image.
(Inherited from DataAdapter)
list(normalizedPath) Promise<ListedFiles> Retrieve a list of all files and folders inside the given folder, non-recursive.
(Inherited from DataAdapter)
listRecursive(normalizedPath) Promise<void> Generates this.files for specific directory of the vault
mkdir(normalizedPath) Promise<void> Create a directory.
(Inherited from DataAdapter)
onFileChange(normalizedPath) void Handle a file change event for the given path.
process(normalizedPath, fn, options?) Promise<string> Atomically read, modify, and save the contents of a plaintext file.
(Inherited from DataAdapter)
queue(fn) Promise<T> Add a function to the queue and return a promise for its result.
(Inherited from PromisedQueue)
read(normalizedPath) Promise<string> Read the contents of a file.
(Inherited from DataAdapter)
readBinary(normalizedPath) Promise<ArrayBuffer> Read the contents of a binary file.
(Inherited from DataAdapter)
reconcileDeletion(normalizedPath, normalizedNewPath, shouldSkipDeletionTimeout?) Promise<void> Reconcile a deletion.
reconcileFile(normalizedPath, normalizedNewPath, shouldSkipDeletionTimeout?) Promise<void> Reconcile a file.
reconcileFolderCreation(normalizedPath, normalizedNewPath) Promise<void> Reconcile a folder creation between old and new paths.
reconcileInternalFile(normalizedPath) Promise<void> Reconcile changes to an internal (config) file.
reconcileSymbolicLinkCreation(normalizedPath, normalizedNewPath) Promise<void> Reconcile a symbolic link creation between old and new paths.
remove(normalizedPath) Promise<void> Delete a file.
(Inherited from DataAdapter)
removeFile(normalizedPath) void Remove file from files listing and trigger deletion event.
rename(normalizedPath, normalizedNewPath) Promise<void> Rename a file or folder.
(Inherited from DataAdapter)
rmdir(normalizedPath, recursive) Promise<void> Remove a directory.
(Inherited from DataAdapter)
stat(normalizedPath) Promise<Stat | null> Retrieve metadata about the given file/folder.
(Inherited from DataAdapter)
stopWatch() void Remove all listeners.
trashLocal(normalizedPath) Promise<void> Move to local trash. Files will be moved into the .trash folder at the root of the vault.
(Inherited from DataAdapter)
trashSystem(normalizedPath) Promise<boolean> Try moving to system trash.
(Inherited from DataAdapter)
update(normalizedPath) Promise<void> Set whether OS is insensitive to case.
watch(handler) Promise<void> Add change watcher to path.
write(normalizedPath, data, options?) Promise<void> Write to a plaintext file. If the file exists its content will be overwritten, otherwise the file will be created.
(Inherited from DataAdapter)
writeBinary(normalizedPath, data, options?) Promise<void> Write to a binary file. If the file exists its content will be overwritten, otherwise the file will be created.
(Inherited from DataAdapter)

Links to this page: