# Class: BAttachment

## 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.

## Constructor

#### new BAttachment()

Source:
  - becca/entities/battachment.js, line 20

### Extends

- AbstractBeccaEntity

### Members

#### attachmentId :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 39

#### (protected) becca

Overrides:
  - AbstractBeccaEntity#becca
Source:
  - becca/entities/abstract_becca_entity.js, line 35

#### blobId :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 54

#### contentLength :int

optionally added to the entity

##### Type:

- int

Source:
  - becca/entities/battachment.js, line 68

#### dateModified :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 58

#### isProtected :boolean

##### Type:

- boolean

Source:
  - becca/entities/battachment.js, line 56

#### mime :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 48

#### ownerId :string

either noteId or revisionId to which this attachment belongs

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 44

#### position :int

##### Type:

- int

Source:
  - becca/entities/battachment.js, line 52

#### role :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 46

#### title :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 50

#### utcDateModified :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 60

#### utcDateScheduledForErasureSince :string

##### Type:

- string

Source:
  - becca/entities/battachment.js, line 62

### Methods

#### (protected) _getContent() → {string|Buffer}

Overrides:
  - AbstractBeccaEntity#_getContent
Source:
  - becca/entities/abstract_becca_entity.js, line 250

##### Returns:

Type
  string | Buffer

#### (protected) _setContent()

Overrides:
  - AbstractBeccaEntity#_setContent
Source:
  - becca/entities/abstract_becca_entity.js, line 128

#### (protected) beforeSaving()

Overrides:
  - AbstractBeccaEntity#beforeSaving
Source:
  - becca/entities/abstract_becca_entity.js, line 20

#### convertToNote() → {Object}

Source:
  - becca/entities/battachment.js, line 138

##### Returns:

Type
  Object

#### copy() → {BAttachment}

Source:
  - becca/entities/battachment.js, line 74

##### Returns:

Type
  BAttachment

#### (protected) generateHash() → {string}

Overrides:
  - AbstractBeccaEntity#generateHash
Source:
  - becca/entities/abstract_becca_entity.js, line 59

##### Returns:

Type
  string

#### getContent() → {string|Buffer}

Source:
  - becca/entities/battachment.js, line 123

##### Returns:

Type
  string | Buffer

#### getNote() → {BNote}

Source:
  - becca/entities/battachment.js, line 86

##### Returns:

Type
  BNote

#### (abstract, protected) getPojo()

Overrides:
  - AbstractBeccaEntity#getPojo
Source:
  - becca/entities/abstract_becca_entity.js, line 82

#### (protected) getPojoToSave()

Overrides:
  - AbstractBeccaEntity#getPojoToSave
Source:
  - becca/entities/abstract_becca_entity.js, line 74

#### (protected) getUtcDateChanged()

Overrides:
  - AbstractBeccaEntity#getUtcDateChanged
Source:
  - becca/entities/abstract_becca_entity.js, line 27

#### hasStringContent() → {boolean}

Source:
  - becca/entities/battachment.js, line 91

##### Returns:

true if the note has string content (not binary)

Type
  boolean

#### markAsDeleted(deleteIdopt)

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:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`deleteId` |  | <optional> | null |

Overrides:
  - AbstractBeccaEntity#markAsDeleted
Source:
  - becca/entities/abstract_becca_entity.js, line 267

#### (protected) putEntityChange()

Overrides:
  - AbstractBeccaEntity#putEntityChange
Source:
  - becca/entities/abstract_becca_entity.js, line 44

#### save() → {this}

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

Overrides:
  - AbstractBeccaEntity#save
Source:
  - becca/entities/abstract_becca_entity.js, line 91

##### Returns:

Type
  this

#### setContent(content, optsopt)

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`content` |  |  |
`opts` | object | <optional> | ###### Properties
Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`forceSave` | object | <optional> | false | will also save this BAttachment entity
`forceFrontendReload` | object | <optional> | false | override frontend heuristics on when to reload, instruct to reload

Source:
  - becca/entities/battachment.js, line 133