This is an implementation of the routing record format used by libp2p to store data in the datastore passed to the libp2p constructor.
import { Libp2pRecord } from '@libp2p/record'const buf = Uint8Array.from([0, 1, 2, 3])const record = Libp2pRecord.deserialize(buf) Copy
import { Libp2pRecord } from '@libp2p/record'const buf = Uint8Array.from([0, 1, 2, 3])const record = Libp2pRecord.deserialize(buf)
import { Libp2pRecord } from '@libp2p/record'const key = Uint8Array.from([0, 1, 2, 3])const value = Uint8Array.from([0, 1, 2, 3])const timeReceived = new Date()const record = new Libp2pRecord(key, value, timeReceived)const buf = record.serialize() Copy
import { Libp2pRecord } from '@libp2p/record'const key = Uint8Array.from([0, 1, 2, 3])const value = Uint8Array.from([0, 1, 2, 3])const timeReceived = new Date()const record = new Libp2pRecord(key, value, timeReceived)const buf = record.serialize()
This is an implementation of the routing record format used by libp2p to store data in the datastore passed to the libp2p constructor.
Example: Deserialization
Example: Serialization