# Class default

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.

#### Hierarchy (View Summary)

- default<default>
  - default

- Defined in becca/entities/battachment.ts:33

#####
Index

### Constructors

constructor

### Properties

attachmentId?
blobId?
contentLength?
dateCreated?
dateModified?
isDecrypted?
isProtected?
isSynced?
mime
noteId?
ownerId
position?
role
title
type?
utcDateCreated
utcDateModified?
utcDateScheduledForErasureSince?

### Accessors

becca
isDeleted
entityName
hashedProperties
primaryKeyName

### Methods

_getContent
_setContent
beforeSaving
convertToNote
copy
decrypt
generateHash
getContent
getFileName
getNote
getPojo
getPojoToSave
getTitleOrProtected
getUtcDateChanged
hasStringContent
init
isContentAvailable
markAsDeleted
markAsDeletedSimple
putEntityChange
save
setContent
updateFromRow

##
Constructors

### constructor

- new default(row: AttachmentRow): default

- #### Parameters

  - row: AttachmentRow

  #### Returns default

  Overrides default.constructor

  - Defined in becca/entities/battachment.ts:52

##
Properties

### `Optional` attachmentId

attachmentId?: string

- Defined in becca/entities/battachment.ts:39

### `Optional` blobId

blobId?: string

Inherited from default.blobId

- Defined in becca/entities/abstract_becca_entity.ts:35

### `Optional` contentLength

contentLength?: number

optionally added to the entity

- Defined in becca/entities/battachment.ts:49

### `Optional` dateCreated

dateCreated?: string

Inherited from default.dateCreated

- Defined in becca/entities/abstract_becca_entity.ts:28

### `Optional` dateModified

dateModified?: string

Inherited from default.dateModified

- Defined in becca/entities/abstract_becca_entity.ts:29

### `Optional` isDecrypted

isDecrypted?: boolean

- Defined in becca/entities/battachment.ts:50

### `Optional` isProtected

isProtected?: boolean

Inherited from default.isProtected

- Defined in becca/entities/abstract_becca_entity.ts:33

### `Optional` isSynced

isSynced?: boolean

Inherited from default.isSynced

- Defined in becca/entities/abstract_becca_entity.ts:34

### mime

mime: string

- Defined in becca/entities/battachment.ts:43

### `Optional` noteId

noteId?: number

- Defined in becca/entities/battachment.ts:38

### ownerId

ownerId: string

either noteId or revisionId to which this attachment belongs

- Defined in becca/entities/battachment.ts:41

### `Optional` position

position?: number

- Defined in becca/entities/battachment.ts:46

### role

role: string

- Defined in becca/entities/battachment.ts:42

### title

title: string

- Defined in becca/entities/battachment.ts:44

### `Optional` type

type?: "file" | "image"

- Defined in becca/entities/battachment.ts:45

### utcDateCreated

utcDateCreated: string

Inherited from default.utcDateCreated

- Defined in becca/entities/abstract_becca_entity.ts:31

### `Optional` utcDateModified

utcDateModified?: string

Inherited from default.utcDateModified

- Defined in becca/entities/abstract_becca_entity.ts:27

### `Optional` utcDateScheduledForErasureSince

utcDateScheduledForErasureSince?: null | string

- Defined in becca/entities/battachment.ts:47

##
Accessors

### `Protected` becca

- get becca(): Becca

- #### Returns Becca

  Inherited from AbstractBeccaEntity.becca

  - Defined in becca/entities/abstract_becca_entity.ts:48

### isDeleted

- get isDeleted(): boolean

- #### Returns boolean

  Inherited from AbstractBeccaEntity.isDeleted

  - Defined in becca/entities/abstract_becca_entity.ts:96

### `Static` entityName

- get entityName(): string

- #### Returns string

  - Defined in becca/entities/battachment.ts:34

### `Static` hashedProperties

- get hashedProperties(): string[]

- #### Returns string[]

  - Defined in becca/entities/battachment.ts:36

### `Static` primaryKeyName

- get primaryKeyName(): string

- #### Returns string

  - Defined in becca/entities/battachment.ts:35

##
Methods

### `Protected`_getContent

- _getContent(): string | Buffer<ArrayBufferLike>

- #### Returns string | Buffer<ArrayBufferLike>

  Inherited from default._getContent

  - Defined in becca/entities/abstract_becca_entity.ts:264

### `Protected`_setContent

- _setContent(content: string | Buffer<ArrayBufferLike>, opts?: ContentOpts): void

- #### Parameters

  - content: string | Buffer<ArrayBufferLike>
  - opts: ContentOpts = {}

  #### Returns void

  Inherited from default._setContent

  - Defined in becca/entities/abstract_becca_entity.ts:141

### beforeSaving

- beforeSaving(): void

- #### Returns void

  Overrides default.beforeSaving

  - Defined in becca/entities/battachment.ts:199

### convertToNote

- convertToNote(): { branch: default; note: default }

- #### Returns { branch: default; note: default }

  - Defined in becca/entities/battachment.ts:139

### copy

- copy(): default

- #### Returns default

  - Defined in becca/entities/battachment.ts:84

### decrypt

- decrypt(): void

- #### Returns void

  - Defined in becca/entities/battachment.ts:114

### generateHash

- generateHash(isDeleted?: boolean): string

- #### Parameters

  - `Optional` isDeleted: boolean

  #### Returns string

  Inherited from default.generateHash

  - Defined in becca/entities/abstract_becca_entity.ts:64

### getContent

- getContent(): Buffer<ArrayBufferLike>

- #### Returns Buffer<ArrayBufferLike>

  - Defined in becca/entities/battachment.ts:131

### getFileName

- getFileName(): string

- #### Returns string

  - Defined in becca/entities/battachment.ts:193

### getNote

- getNote(): default

- #### Returns default

  - Defined in becca/entities/battachment.ts:95

### getPojo

- getPojo(): {
  attachmentId: undefined
  | string;
  blobId: undefined | string;
  contentLength: undefined | number;
  dateModified: undefined | string;
  isDeleted: boolean;
  isProtected: boolean;
  mime: string;
  ownerId: string;
  position: undefined | number;
  role: string;
  title: undefined | string;
  utcDateModified: undefined | string;
  utcDateScheduledForErasureSince: undefined | null | string;
  }

- #### Returns {
  attachmentId: undefined | string;
  blobId: undefined | string;
  contentLength: undefined | number;
  dateModified: undefined | string;
  isDeleted: boolean;
  isProtected: boolean;
  mime: string;
  ownerId: string;
  position: undefined | number;
  role: string;
  title: undefined | string;
  utcDateModified: undefined | string;
  utcDateScheduledForErasureSince: undefined | null | string;
  }

  Overrides default.getPojo

  - Defined in becca/entities/battachment.ts:212

### getPojoToSave

- getPojoToSave(): {
  attachmentId: undefined
  | string;
  blobId: undefined | string;
  contentLength: undefined | number;
  dateModified: undefined | string;
  isDeleted: boolean;
  isProtected: boolean;
  mime: string;
  ownerId: string;
  position: undefined | number;
  role: string;
  title: undefined | string;
  utcDateModified: undefined | string;
  utcDateScheduledForErasureSince: undefined | null | string;
  }

- #### Returns {
  attachmentId: undefined | string;
  blobId: undefined | string;
  contentLength: undefined | number;
  dateModified: undefined | string;
  isDeleted: boolean;
  isProtected: boolean;
  mime: string;
  ownerId: string;
  position: undefined | number;
  role: string;
  title: undefined | string;
  utcDateModified: undefined | string;
  utcDateScheduledForErasureSince: undefined | null | string;
  }

  Overrides default.getPojoToSave

  - Defined in becca/entities/battachment.ts:230

### getTitleOrProtected

- getTitleOrProtected(): string

- #### Returns string

  - Defined in becca/entities/battachment.ts:110

### getUtcDateChanged

- getUtcDateChanged(): string

- #### Returns string

  Inherited from default.getUtcDateChanged

  - Defined in becca/entities/abstract_becca_entity.ts:44

### hasStringContent

- hasStringContent(): boolean

- #### Returns boolean

  true if the note has string content (not binary)

  Overrides default.hasStringContent

  - Defined in becca/entities/battachment.ts:100

### init

- init(): void

- #### Returns void

  Inherited from default.init

  - Defined in becca/entities/abstract_becca_entity.ts:90

### isContentAvailable

- isContentAvailable(): boolean

- #### Returns boolean

  - Defined in becca/entities/battachment.ts:104

### markAsDeleted

- markAsDeleted(deleteId?: null | string): void

- 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

  - deleteId: null | string = null

  #### Returns void

  Inherited from default.markAsDeleted

  - Defined in becca/entities/abstract_becca_entity.ts:280

### markAsDeletedSimple

- markAsDeletedSimple(): void

- #### Returns void

  Inherited from default.markAsDeletedSimple

  - Defined in becca/entities/abstract_becca_entity.ts:305

### `Protected` putEntityChange

- putEntityChange(isDeleted: boolean): void

- #### Parameters

  - isDeleted: boolean

  #### Returns void

  Inherited from default.putEntityChange

  - Defined in becca/entities/abstract_becca_entity.ts:52

### save

- save(opts?: {}): this

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

  #### Parameters

  - `Optional` opts: {}

  #### Returns this

  Inherited from default.save

  - Defined in becca/entities/abstract_becca_entity.ts:104

### setContent

- setContent(content: string | Buffer<ArrayBufferLike>, opts?: ContentOpts): void

- #### Parameters

  - content: string | Buffer<ArrayBufferLike>
  - `Optional` opts: ContentOpts

  #### Returns void

  - Defined in becca/entities/battachment.ts:135

### updateFromRow

- updateFromRow(row: AttachmentRow): void

- #### Parameters

  - row: AttachmentRow

  #### Returns void

  Overrides default.updateFromRow

  - Defined in becca/entities/battachment.ts:59