# @synonymdev/slashtags-profile

> Slashtags Profile helper module.

Latest version **2.0.0** (published 2024-07-26) · 0 weekly downloads

## Install

```sh
npm install @synonymdev/slashtags-profile
pnpm add @synonymdev/slashtags-profile
yarn add @synonymdev/slashtags-profile
bun add @synonymdev/slashtags-profile
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-07-26 |
| First published | 2023-05-17 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 10.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dzdidi_restored, pwltr, miguelmedeirosweb, rbndg, bitcoinerrorlog, jayvdb, coreyphillips, nzh |

## Links

- npm: https://www.npmjs.com/package/@synonymdev/slashtags-profile
- npm.io page: https://npm.io/package/@synonymdev/slashtags-profile

## Dependencies (2)

- [ajv](https://npm.io/package/ajv.md) ^8.12.0
- [@synonymdev/slashtags-url](https://npm.io/package/@synonymdev/slashtags-url.md) ^1.0.0-alpha.3

## Recent versions

- 2.0.0 (latest) — 2024-07-26
- 1.0.2 — 2023-10-06
- 1.0.1 — 2023-09-05
- 1.0.0 — 2023-09-05
- 1.0.0-alpha.2 — 2023-06-02
- 1.0.0-alpha.1 — 2023-05-24
- 1.0.0-alpha.0 — 2023-05-17

## README

# slashtags-profile

Slashtags Profile helper module.

## Install

```bash
npm install @synonymdev/slashtags-profile
```

## Usage

Initialize

```js
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 

```js
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](https://github.com/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.

---
_Source: https://npm.io/package/@synonymdev/slashtags-profile · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
