# @nichoth/wnfs-blobs

> Fission storage for hermes

Latest version **0.1.0** (published 2023-03-18) · AGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @nichoth/wnfs-blobs
pnpm add @nichoth/wnfs-blobs
yarn add @nichoth/wnfs-blobs
bun add @nichoth/wnfs-blobs
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2023-03-18 |
| First published | 2023-03-16 |
| Weekly downloads | 0 |
| License | AGPL-3.0-or-later |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 1.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | nichoth |
| Maintainers | nichoth |

## Links

- npm: https://www.npmjs.com/package/@nichoth/wnfs-blobs
- Repository: https://github.com/nichoth/hermes-fission
- Homepage: https://github.com/nichoth/hermes-fission#readme
- Issues: https://github.com/nichoth/hermes-fission/issues
- npm.io page: https://npm.io/package/@nichoth/wnfs-blobs

## Dependencies (3)

- [uint8arrays](https://npm.io/package/uint8arrays.md) ^4.0.3
- [monotonic-timestamp](https://npm.io/package/monotonic-timestamp.md) ^0.0.9
- [json-stable-stringify](https://npm.io/package/json-stable-stringify.md) ^1.0.2

## Recent versions

- 0.1.0 (latest) — 2023-03-18
- 0.0.2 — 2023-03-16
- 0.0.1 — 2023-03-16
- 0.0.0 — 2023-03-16

## README

# wnfs blobs

Use Fission as storage for post objects with associated blobs.

## install
```
npm i -S @nichoth/wnfs-blobs
```

## example

### create a post

`wnfsBlobs.post` will write a given post and blob to your `wnfs` filesystem, and then return the post.

```ts
import { test } from 'tapzero'
import { createDID, createUsername } from 'wnfs-blobs/util'
import { WnfsBlobs } from 'wnfs-blobs/index'

test('make a post', async t => {
    const APP_INFO = { name: 'test', creator: 'test' }

    const program = await wn.program({
        namespace: APP_INFO
    })
    const { crypto } = program.components
    const username = await createUsername(await createDID(crypto))

    // *must* call `register` before we use the `session`
    await program.auth.register({ username })
    const session = program.session ?? await program.auth.session()

    const wnfsBlobs = new WnfsBlobs({
        wnfs: session.fs,
        APP_INFO,
        program
    })

    const post = await wnfsBlobs.post(file, {
        text: 'testing'
    })

    t.equal(post.author, await writeKeyToDid(program.components.crypto),
        'should have the right author in the post')
    t.ok(post.signature, 'should have a signature')
    t.equal(post.content.type, 'post', 'should set content.type')
    t.equal(post.content.text, 'testing', 'should set content.text')
})
```

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