FileManagergetAvailablePathForAttachment

FileManager.getAvailablePathForAttachment() method

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): Promise<string>;

Parameters

ParameterTypeDescription
filenamestringName of the attachment being saved
sourcePathstring(Optional) The path to the note associated with this attachment, defaults to the workspace’s active file.

Returns:

Promise<string>

Full path for where the attachment should be saved, according to the user’s settings