Slashtags Profile helper module.
npm install @synonymdev/slashtags-profile
Initialize
const { Client } = require('@synonymdev/web-relay')
const SlashtagsProfile = require('@synonymdev/slashtags-profile')
const client = new Client({ storage: "path/to/storage", relay: address })
const writer = new SlashtagsProfile(client)
const profile = { name: 'foo' }
await writer.put(profile)
const url = await writer.createURL()
Resolve profile as a reader
const { Client } = require('@synonymdev/web-relay')
const SlashtagsProfile = require('@synonymdev/slashtags-profile')
const client = new Client({ storage: "path/to/storage "})
const reader = new SlashtagsProfile(client)
const resolved = await reader.get(url) // URL from writer side
// {name: 'foo'}
Create a new SlashtagsProfile instance.
WebRelayClient
slashtags-web-relay instance.
Creates a sharable url
to allow remote readers to read this profile.
Closes the underlying web relay client.
Puts a new profile value. profile
param should be an object following its type definition.
Deletes the value from the underlying hyperdrive.
Read a local profile if no url
is passed, or a remote one if url
is passed.
Watch updates to a remote file, and call onupdate(profile)
function with current profile.