https://github.com/multiformats/js-multicodec
JavaScript implementation of the multicodec specification
https://github.com/multiformats/js-multicodec
Last synced: 10 months ago
JSON representation
JavaScript implementation of the multicodec specification
- Host: GitHub
- URL: https://github.com/multiformats/js-multicodec
- Owner: multiformats
- License: mit
- Created: 2016-09-01T19:58:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2025-05-09T20:04:05.000Z (about 1 year ago)
- Last Synced: 2025-08-21T19:43:33.340Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 1.85 MB
- Stars: 21
- Watchers: 16
- Forks: 21
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ⛔️ DEPRECATED: This module has been superseded by the [multiformats](https://github.com/multiformats/js-multiformats) module
# js-multicodec
[](https://protocol.ai)
[](https://github.com/multiformats/multiformats)
[](https://webchat.freenode.net/?channels=%23ipfs)
[](https://github.com/RichardLitt/standard-readme)


> JavaScript implementation of the multicodec specification
## Lead Maintainer
[Henrique Dias](http://github.com/hacdias)
## Table of Contents
- [Install](#install)
- [Usage](#usage)
- [Example](#example)
- [API](#api)
- [Updating the lookup table](#updating-the-lookup-table)
- [Contribute](#contribute)
- [License](#license)
## Install
```sh
> npm install multicodec
```
## Usage
### Example
```JavaScript
const multicodec = require('multicodec')
const prefixedProtobuf = multicodec.addPrefix('protobuf', protobufBuffer)
// prefixedProtobuf 0x50...
// The multicodec codec values can be accessed directly:
console.log(multicodec.DAG_CBOR)
// 113
// To get the string representation of a codec, e.g. for error messages:
console.log(multicodec.getNameFromCode(113))
// dag-cbor
```
### API
https://multiformats.github.io/js-multicodec/
[multicodec default table](https://github.com/multiformats/multicodec/blob/master/table.csv)
## Updating the lookup table
Updating the lookup table is done with a script. The source of truth is the
[multicodec default table](https://github.com/multiformats/multicodec/blob/master/table.csv).
Update the table with running:
npm run update-table
## Contribute
Contributions welcome. Please check out [the issues](https://github.com/multiformats/js-multicodec/issues).
Check out our [contributing document](https://github.com/multiformats/multiformats/blob/master/contributing.md) for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
## License
[MIT](LICENSE) © 2016 Protocol Labs Inc.