> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# FileDurability

> Class exported by @botmesh/core.

Defined in: [durability/file.ts:216](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/file.ts#L216)

[DurabilityBackend](https://botmesh.afaya.com.co/api/core/interfaces/DurabilityBackend.md) persisted to a JSON file (single process).

## Extends

* [`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability)

## Properties

### inbox

```ts theme={null}
readonly inbox: InboxJournal;
```

Defined in: [durability/journal.ts:383](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L383)

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`inbox`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#inbox)

***

### outbox

```ts theme={null}
readonly outbox: OutboxJournal;
```

Defined in: [durability/journal.ts:384](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L384)

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`outbox`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#outbox)

***

### exclusive

```ts theme={null}
readonly exclusive: boolean;
```

Defined in: [durability/journal.ts:385](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L385)

`true` when only one process can use the backend at a time (memory, file). A restarted
process then knows every lease of its `instanceId` is its own dead incarnation's.

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`exclusive`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#exclusive)

***

### scopeName

```ts theme={null}
readonly scopeName: string | undefined;
```

Defined in: [durability/journal.ts:387](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L387)

The scope of this view (`undefined` = the unscoped tables).

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`scopeName`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#scopename)

***

### kv

```ts theme={null}
readonly kv: DurableKv;
```

Defined in: [durability/journal.ts:388](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L388)

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`kv`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#kv)

## Methods

### open()

```ts theme={null}
static open(filePath, options?): Promise<FileDurability>;
```

Defined in: [durability/file.ts:233](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/file.ts#L233)

Open (or create) the journal at `filePath`.

#### Parameters

| Parameter | Type |
| - | - |
| `filePath` | `string` |
| `options?` | [`FileDurabilityOptions`](https://botmesh.afaya.com.co/api/core/interfaces/FileDurabilityOptions) |

#### Returns

`Promise`\<`FileDurability`>

#### Throws

when another live process holds the lock, another open journal of this
process holds it, or the file is not a valid journal.

***

### close()

```ts theme={null}
close(): Promise<void>;
```

Defined in: [durability/file.ts:315](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/file.ts#L315)

Wait for pending writes and release the lock file. Idempotent; later writes reject (a
closed journal never writes without its lock). The bot does NOT call this on `stop()`
(a restart reuses the instance).

#### Returns

`Promise`\<`void`>

***

### scope()

```ts theme={null}
scope(name): KvDurability;
```

Defined in: [durability/journal.ts:397](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L397)

A view over the same KV holding only the records of `name` (tables `inbox:<name>` / `outbox:<name>`).

#### Parameters

| Parameter | Type |
| - | - |
| `name` | `string` |

#### Returns

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability)

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`scope`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#scope)

***

### start()

```ts theme={null}
start(): Promise<void>;
```

Defined in: [durability/journal.ts:402](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L402)

Called by `bot.start()` before anything is replayed.

#### Returns

`Promise`\<`void`>

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`start`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#start)

***

### stop()

```ts theme={null}
stop(): Promise<void>;
```

Defined in: [durability/journal.ts:403](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/journal.ts#L403)

Called by `bot.stop()` after the provider stopped.

#### Returns

`Promise`\<`void`>

#### Inherited from

[`KvDurability`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability).[`stop`](https://botmesh.afaya.com.co/api/core/spi/classes/KvDurability#stop)

## Accessors

### locked

#### Get Signature

```ts theme={null}
get locked(): boolean;
```

Defined in: [durability/file.ts:226](https://github.com/andresayac/botmesh/blob/main/packages/core/src/durability/file.ts#L226)

The file is held under the advisory lock and the journal is not closed.

##### Returns

`boolean`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.