@textile/hub > Client > newDBFromAddr
Client.newDBFromAddr() method
newDBFromAddr initializes the client with the given store, connecting to the given thread address (database). It should be called before any operation on the store, and is an alternative to start, which creates a local store. newDBFromAddr should also include the read/follow key, which should be a Uint8Array or base32-encoded string.
Signature:
newDBFromAddr(address: string, key: string | Uint8Array, collections?: Array<CollectionConfig>): Promise<ThreadID>;
Parameters
Parameter | Type | Description |
---|---|---|
address | string | The address for the thread with which to connect. Should be of the form /ip4/<url/ip-address>/tcp/ |
key | string | Uint8Array | The set of keys to use to connect to the database |
collections | Array<CollectionConfig> | Array of CollectionConfig objects for seeding the DB with collections. |
Returns:
Promise<ThreadID>
Remarks
See getDBInfo for a possible source of the address and keys. See ThreadKey for information about thread keys.