# multicodec

> JavaScript implementation of the multicodec specification

Latest version **3.2.1** (published 2021-09-02) · MIT license · 1.0M weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install multicodec
pnpm add multicodec
yarn add multicodec
bun add multicodec
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 3.2.1 |
| Published | 2021-09-02 |
| First published | 2016-09-26 |
| Weekly downloads | 1.0M |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 237.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Maintainers | daviddias, vmx, mikeal, hugomrdias, achingbrain, hacdias |
| Keywords | IPFS, multiformats, multicodec, binary, packed, the, data! |

## Links

- npm: https://www.npmjs.com/package/multicodec
- Repository: https://github.com/multiformats/js-multicodec
- Homepage: https://github.com/multiformats/js-multicodec#readme
- Issues: https://github.com/multiformats/js-multicodec/issues
- npm.io page: https://npm.io/package/multicodec

## Dependencies (2)

- [varint](https://npm.io/package/varint.md) ^6.0.0
- [uint8arrays](https://npm.io/package/uint8arrays.md) ^3.0.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 3.2.1 (latest) — 2021-09-02
- 3.2.0 — 2021-08-30
- 3.1.1 — 2021-08-24
- 3.1.0 — 2021-06-24
- 3.0.1 — 2021-03-02
- 2.1.3 — 2021-03-02
- 3.0.0 — 2021-03-02
- 2.1.2 — 2021-03-02
- 2.1.1 — 2021-03-02
- 2.1.0 — 2020-12-11
- 2.0.4 — 2020-12-11
- 2.0.3 — 2020-12-11
- 2.0.2 — 2020-12-11
- 2.0.1 — 2020-09-07
- 2.0.0 — 2020-07-31
- … 30 more at https://npm.io/package/multicodec/versions

## README

# ⛔️ DEPRECATED: This module has been superseded by the [multiformats](https://github.com/multiformats/js-multiformats) module <!-- omit in toc -->

# js-multicodec <!-- omit in toc -->

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai)
[![](https://img.shields.io/badge/project-multiformats-blue.svg?style=flat-square)](https://github.com/multiformats/multiformats)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs)
[![](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/multiformats/js-multicodec/ci/master?style=flat-square)
![Codecov](https://img.shields.io/codecov/c/github/multiformats/js-multicodec?style=flat-square)

> JavaScript implementation of the multicodec specification

## Lead Maintainer <!-- omit in toc -->

[Henrique Dias](http://github.com/hacdias)

## Table of Contents <!-- omit in toc -->

- [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.

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