Skip to content

StorageOptions

StorageOptions = object

Defined in: sdks/js/node-sdk/dist/index.d.ts:84

Storage options

optional dbEncryptionKey?: Uint8Array | HexString

Defined in: sdks/js/node-sdk/dist/index.d.ts:112

Encryption key for the local DB (32 bytes, hex)

https://docs.xmtp.org/sdk/client/#view-an-encrypted-database


optional dbPath?: string | null | ((inboxId) => string)

Defined in: sdks/js/node-sdk/dist/index.d.ts:106

Path to the local DB

There are 4 value types that can be used to specify the database path:

  • undefined (or excluded from the client options) The database will be created in the current working directory and is based on the environment label and client inbox ID. Example: xmtp-default-<inbox-id>.db3

  • null No database will be created and all data will be lost once the client disconnects.

  • string The given path will be used to create the database. Example: ./my-db.db3

  • function A callback function that receives the inbox ID and returns a string path. Example: (inboxId) => string


optional maxDbPoolSize?: number

Defined in: sdks/js/node-sdk/dist/index.d.ts:118

Maximum number of connections in the local DB connection pool.

Defaults to 25 when unset. Ignored when useSingleConnection is true.


optional minDbPoolSize?: number

Defined in: sdks/js/node-sdk/dist/index.d.ts:124

Minimum number of connections kept warm in the local DB connection pool.

Defaults to 5 when unset. Ignored when useSingleConnection is true.


optional useSingleConnection?: boolean

Defined in: sdks/js/node-sdk/dist/index.d.ts:132

When true, the native DB uses a single connection (one file descriptor) instead of a pool. The pool-size options above are ignored. Intended for services running many clients in one process.

Defaults to false (pooled).