OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-unread-anchors / example.mjs

18 lines · javascript ref:
import Unreads from './index.js'
import Corestore from 'corestore'

const store = new Corestore('/tmp/unreads')

const u1 = new Unreads(store)
await u1.ready()

const u2 = new Unreads(store.namespace('something'), [u1.local.key])
await u2.ready()

await u1.addWriter(u2.local.key)

await u1.put(Buffer.alloc(32), { length: 0, timestamp: Date.now() })

console.log(await u1.get(Buffer.alloc(32)))
console.log(await u2.get(Buffer.alloc(32)))