Skip to content

FileManager.getAvailablePathForAttachment method

FileManager › getAvailablePathForAttachment

Official

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.

Signature:

getAvailablePathForAttachment(filename: string, sourcePath?: string | undefined): Promise<string>

Parameters:

ParameterTypeDescription
filenamestringName of the attachment being saved.
sourcePath?string | undefinedThe path to the note associated with this attachment, defaults to the workspace's active file.

Returns: Promise<string> — The full path, according to the user's attachment settings.

Since: 1.5.7