getAttachmentFolderPathForAttachment
Retrieves the folder a given attachment of a note belongs in, without generating the attachment’s name.
This is the question a caller judging only WHERE an attachment should be asks. It is cheaper than taking the folder of getAttachmentFilePath’s answer, because it sets GetAttachmentFilePathParams.shouldSkipGeneratedAttachmentFileName, so Custom Attachment Location skips generating a name, which can walk every link of the note.
The answer can differ from getAttachmentFolderPath’s, which asks on behalf of a dummy attachment: a folder template may read the attachment’s own name, extension or stats.
Import:
import { getAttachmentFolderPathForAttachment } from '@mnaoumov/obsidian-lib/attachment-path';Signature:
function getAttachmentFolderPathForAttachment(params: GetAttachmentFolderPathForAttachmentParams): Promise<string>Parameters:
| Parameter | Type | Description |
|---|---|---|
params |
GetAttachmentFolderPathForAttachmentParams | Parameters for the get attachment folder path for attachment function. |
Returns: Promise<string> — A Promise that resolves to the attachment folder path.
Links to this page: