FileManager
› getAvailablePathForAttachment
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
Parameter | Type | Description |
---|---|---|
filename | string | Name of the attachment being saved |
sourcePath | string | (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