https://github.com/ipld/js-blockcodec-to-ipld-format
Convert a BlockCodec from the multiformats module to an IPLD format
https://github.com/ipld/js-blockcodec-to-ipld-format
Last synced: 3 months ago
JSON representation
Convert a BlockCodec from the multiformats module to an IPLD format
- Host: GitHub
- URL: https://github.com/ipld/js-blockcodec-to-ipld-format
- Owner: ipld
- License: other
- Created: 2021-04-30T06:59:15.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-05-01T08:39:56.000Z (about 1 year ago)
- Last Synced: 2025-11-23T21:00:01.611Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# blockcodec-to-ipld-format
> Convert a [BlockCodec](https://github.com/multiformats/js-multiformats/blob/master/src/codecs/interface.ts#L21) from the [multiformats](https://www.npmjs.com/package/multiformats) module into an
[IPLD Format](https://www.npmjs.com/package/interface-ipld-format) for use with the [IPLD](https://www.npmjs.com/package/ipld) module.
## Table of contents
- [Install](#install)
- [Use](#use)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)
## Install
```console
$ npm i blockcodec-to-ipld-format
```
### Use
```javascript
const { convert } = require('blockcodec-to-ipld-format')
const dagCbor = require('@ipld/dag-cbor')
const format = convert(dagCbor)
// use interface-ipld-format methods
console.info(format.codec)
console.info(format.defaultHashAlg)
console.info(format.util.serialize({ foo: 'bar' }))
// etc..
```
## API
https://ipld.github.io/js-blockcodec-to-ipld-format/
## Contribute
Feel free to join in. All welcome. Open an [issue](https://github.com/ipld/blockcodec-to-ipld-format/issues)!
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
[](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
## License
This project is dual-licensed under Apache 2.0 and MIT terms:
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/ipfs/go-ipfs/blob/master/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](https://github.com/ipfs/go-ipfs/blob/master/LICENSE-MIT) or http://opensource.org/licenses/MIT)