Skip to content

isTreatedAsAttachment

Checks if the given file should be treated as an attachment because of its extension.

Some plugins store their data in files that are markdown on disk but are not prose — Excalidraw, for example, saves each drawing as sketch.excalidraw.md. Obsidian reports such a file’s extension as md, so a caller that wants to tell a drawing apart from a note has to match the full multi-part extension (.excalidraw.md) against the file name. Which extensions count is the caller’s configuration, not this library’s — only the matching rule is shared.

Import:

import { isTreatedAsAttachment } from 'obsidian-dev-utils/obsidian/file-system';

Signature:

function isTreatedAsAttachment(params: IsTreatedAsAttachmentParams): boolean

Parameters:

ParameterTypeDescription
paramsIsTreatedAsAttachmentParamsThe path or file to classify and the configured attachment extensions.

Returns: boolean — A boolean indicating whether the file should be treated as an attachment.


Links to this page: