---
title: "storage | Eidos Docs"
description: "SDK signatures, permissions and behavior for storage."
source: "https://docs.eidos.space/plugins/api/storage/"
lang: "en"
---

# storage

Declare storage.maxBytes. Binary objects are private to the plugin and local to the device, persisting across View and app restarts. read returns null for an absent key. Writes are subject to the declared quota and host limits. Lite API 3.11 adds opt-in storage.atomic: true for readVersioned and compareAndWrite. These compare and replace current object bytes atomically across owner windows; conflicts do not write. Re-read and replay the specific edit, not a stale full snapshot.

Usage guide: [services](https://docs.eidos.space/plugins/services/). [API index](https://docs.eidos.space/plugins/api/).

Signatures, parameters and return types are generated from the SDK. Optional members are not available in every host and context.

## PluginStorage

[Source](https://github.com/mayneyao/eidos/blob/dev/packages/plugin-sdk/src/index.ts#L424)

### PluginStorage.list

Supported hosts: Lite

List stored objects, optionally filtered by key prefix.

```ts
list(prefix?: string): Promise<Array<{
    key: string;
    size: number;
}>>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| prefix    | string | No       |

Returns: `Promise<Array<{ key: string; size: number; }>>`.

### PluginStorage.read

Supported hosts: Lite

Read object bytes, or null for an absent key.

```ts
read(key: string): Promise<Uint8Array | null>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| key       | string | Yes      |

Returns: `Promise<Uint8Array &#124; null>`.

### PluginStorage.write

Supported hosts: Lite

Write an object within the plugin’s storage quota.

```ts
write(key: string, value: Uint8Array): Promise<void>;
```

| Parameter | Type       | Required |
| --------- | ---------- | -------- |
| key       | string     | Yes      |
| value     | Uint8Array | Yes      |

Returns: `Promise<void>`.

### PluginStorage.delete

Supported hosts: Lite

Delete a private stored object.

```ts
delete(key: string): Promise<void>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| key       | string | Yes      |

Returns: `Promise<void>`.

### PluginStorage.readVersioned

Supported hosts: Lite

Lite API 3.11; requires storage.atomic: true. Read bytes and their opaque current-bytes token together. Both are null for an absent key; an empty stored object has a non-null token. Tokens are stable for identical bytes, not monotonic revision numbers.

```ts
readVersioned?(key: string): Promise<StorageSnapshot>;
```

| Parameter | Type   | Required |
| --------- | ------ | -------- |
| key       | string | Yes      |

Returns: `Promise<StorageSnapshot>`.

### PluginStorage.compareAndWrite

Supported hosts: Lite

Lite API 3.11; requires storage.atomic: true. Compare expectedVersion with the current token and replace bytes in one host operation. A conflict returns applied: false and the current token without writing. Reread and replay the specific edit before retrying. The 4 MiB object limit and declared plugin quota still apply.

```ts
compareAndWrite?(key: string, expectedVersion: string | null, data: Uint8Array): Promise<StorageWriteResult>;
```

| Parameter       | Type               | Required |
| --------------- | ------------------ | -------- |
| key             | string             | Yes      |
| expectedVersion | string &#124; null | Yes      |
| data            | Uint8Array         | Yes      |

Returns: `Promise<StorageWriteResult>`.

Related types: [StorageSnapshot](https://docs.eidos.space/plugins/api/storage/#storagesnapshot), [StorageWriteResult](https://docs.eidos.space/plugins/api/storage/#storagewriteresult).

## StorageSnapshot

[Source](https://github.com/mayneyao/eidos/blob/dev/packages/plugin-sdk/src/index.ts#L438)

### StorageSnapshot.data

Supported hosts: Lite

```ts
data: Uint8Array | null;
```

### StorageSnapshot.version

Supported hosts: Lite

```ts
version: string | null;
```

## StorageWriteResult

[Source](https://github.com/mayneyao/eidos/blob/dev/packages/plugin-sdk/src/index.ts#L443)

### StorageWriteResult.applied

Supported hosts: Lite

```ts
applied: boolean;
```

### StorageWriteResult.version

Supported hosts: Lite

```ts
version: string | null;
```
