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:

Parameter Type Description
filename string Name of the attachment being saved
sourcePath? string | undefined 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

Since: 1.5.7