Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fairdatasociety/beeson-multiformats
codec for multiformats
https://github.com/fairdatasociety/beeson-multiformats
Last synced: 7 days ago
JSON representation
codec for multiformats
- Host: GitHub
- URL: https://github.com/fairdatasociety/beeson-multiformats
- Owner: fairDataSociety
- License: mit
- Created: 2022-08-16T20:22:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-16T20:27:32.000Z (almost 2 years ago)
- Last Synced: 2024-10-03T08:17:01.857Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 331 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# beeson-multiformats
beeson codec for multiformats> Block codec for multiformats
**Warning: This project is in alpha state. There might (and most probably will) be changes in the future to its API and working. Also, no guarantees can be made about its stability, efficiency, and security at this stage.**
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)## Install
`npm install @fairdatasociety/beeson-multiformats`
## Usage
```typescript
import * as Block from 'multiformats/block'
import { codec, hasher } from '@fairdatasociety/beeson-multiformats'
import { BeeSon, Type } from '@fairdatasociety/beeson'let json = [0, '1', false, { name: 'john coke' }, 5]
const beeson = new BeeSon({ json })
const value = beeson// encode a block
const block = await Block.encode({ value, codec, hasher })
// cid: `bah6acgzakjrglswz3olz3tvelmgypkn2r67ofl6jh3cnuqsy6zysmc7rqkcq`// decode a block
const block2 = await Block.decode({
bytes: block.bytes,
codec,
hasher,
})
let bs = await block2.value
// json: [0, '1', false, { name: 'john coke' }, 5]
```## Notes
Support for beeson supertypes and container types is not available.
## Maintainers
- [molekilla](https://github.com/molekilla)
## License
[MIT](./LICENSE)