Trilium Backend API
    Preparing search index...

    Interface BAttachment

    Attachment represent data related/attached to the note. Conceptually similar to attributes, but intended for larger amounts of data and generally not accessible to the user.

    interface BAttachment {
        attachmentId?: string;
        blobId?: string;
        contentLength?: number;
        dateCreated?: string;
        dateModified?: string;
        isDecrypted?: boolean;
        isProtected?: boolean;
        isSynced?: boolean;
        mime: string;
        noteId?: number;
        ownerId: string;
        position?: number;
        role: string;
        title: string;
        type?: "image" | "file";
        utcDateCreated: string;
        utcDateModified?: string;
        utcDateScheduledForErasureSince?: string;
        get becca(): default;
        get isDeleted(): boolean;
        _getContent(): string | Buffer<ArrayBufferLike>;
        _setContent(
            content: string | Buffer<ArrayBufferLike>,
            opts?: ContentOpts,
        ): void;
        beforeSaving(): void;
        convertToNote(): { branch: BBranch; note: BNote };
        copy(): BAttachment;
        decrypt(): void;
        generateHash(isDeleted?: boolean): string;
        getContent(): Buffer;
        getFileName(): string;
        getNote(): BNote;
        getPojo(): {
            attachmentId: string;
            blobId: string;
            contentLength: number;
            dateModified: string;
            isDeleted: boolean;
            isProtected: boolean;
            mime: string;
            ownerId: string;
            position: number;
            role: string;
            title: string;
            utcDateModified: string;
            utcDateScheduledForErasureSince: string;
        };
        getPojoToSave(): {
            attachmentId: string;
            blobId: string;
            contentLength: number;
            dateModified: string;
            isDeleted: boolean;
            isProtected: boolean;
            mime: string;
            ownerId: string;
            position: number;
            role: string;
            title: string;
            utcDateModified: string;
            utcDateScheduledForErasureSince: string;
        };
        getTitleOrProtected(): string;
        getUtcDateChanged(): string;
        hasStringContent(): boolean;
        init(): void;
        isContentAvailable(): boolean;
        markAsDeleted(deleteId?: string): void;
        markAsDeletedSimple(): void;
        putEntityChange(isDeleted: boolean): void;
        save(opts?: {}): this;
        setContent(
            content: string | Buffer<ArrayBufferLike>,
            opts?: ContentOpts,
        ): void;
        updateFromRow(row: AttachmentRow): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    attachmentId?: string
    blobId?: string
    contentLength?: number

    optionally added to the entity

    dateCreated?: string
    dateModified?: string
    isDecrypted?: boolean
    isProtected?: boolean
    isSynced?: boolean
    mime: string
    noteId?: number
    ownerId: string

    either noteId or revisionId to which this attachment belongs

    position?: number
    role: string
    title: string
    type?: "image" | "file"
    utcDateCreated: string
    utcDateModified?: string
    utcDateScheduledForErasureSince?: string

    Accessors

    • get becca(): default

      Returns default

    • get isDeleted(): boolean

      Returns boolean

    Methods

    • Returns { branch: BBranch; note: BNote }

    • Returns void

    • Parameters

      • OptionalisDeleted: boolean

      Returns string

    • Returns Buffer

    • Returns string

    • Returns BNote

    • Returns {
          attachmentId: string;
          blobId: string;
          contentLength: number;
          dateModified: string;
          isDeleted: boolean;
          isProtected: boolean;
          mime: string;
          ownerId: string;
          position: number;
          role: string;
          title: string;
          utcDateModified: string;
          utcDateScheduledForErasureSince: string;
      }

    • Returns {
          attachmentId: string;
          blobId: string;
          contentLength: number;
          dateModified: string;
          isDeleted: boolean;
          isProtected: boolean;
          mime: string;
          ownerId: string;
          position: number;
          role: string;
          title: string;
          utcDateModified: string;
          utcDateScheduledForErasureSince: string;
      }

    • Returns string

    • Returns boolean

      true if the note has string content (not binary)

    • Returns void

    • Returns boolean

    • Mark the entity as (soft) deleted. It will be completely erased later.

      This is a low-level method, for notes and branches use note.deleteNote() and 'branch.deleteBranch()` instead.

      Parameters

      • OptionaldeleteId: string

      Returns void

    • Parameters

      • isDeleted: boolean

      Returns void

    • Saves entity - executes SQL, but doesn't commit the transaction on its own

      Parameters

      • Optionalopts: {}

      Returns this