🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@synonymdev/slashtags-profile

Package Overview
Dependencies
Maintainers
8
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synonymdev/slashtags-profile

Slashtags Profile helper module.

latest
npmnpm
Version
2.0.0
Version published
Maintainers
8
Created
Source

slashtags-profile

Slashtags Profile helper module.

Install

npm install @synonymdev/slashtags-profile

Usage

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'}

API

const profile = new SlashtagsProfile(WebRelayClient)

Create a new SlashtagsProfile instance.

  • WebRelayClient slashtags-web-relay instance.

const url = await profile.createURL()

Creates a sharable url to allow remote readers to read this profile.

await profile.close()

Closes the underlying web relay client.

await profile.put(profile)

Puts a new profile value. profile param should be an object following its type definition.

await profile.del()

Deletes the value from the underlying hyperdrive.

await profile.get([url])

Read a local profile if no url is passed, or a remote one if url is passed.

await profile.subscribe(url, onupdate)

Watch updates to a remote file, and call onupdate(profile) function with current profile.

FAQs

Package last updated on 26 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts