# wire-webapp-cbor

> Implementation of Concise Binary Object Representation (CBOR) data format (RFC7049).

Latest version **2.1.5** (published 2017-09-01) · GPL-3.0 license · 0 weekly downloads

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

## Install

```sh
npm install wire-webapp-cbor
pnpm add wire-webapp-cbor
yarn add wire-webapp-cbor
bun add wire-webapp-cbor
```

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.5 |
| Published | 2017-09-01 |
| First published | 2016-09-21 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | yserz, wireapp-member, ffflorian, herrmannplatz, lipis, bennyn, wireapp-owner |

## Links

- npm: https://www.npmjs.com/package/wire-webapp-cbor
- Repository: https://github.com/wireapp/wire-webapp-cbor
- Homepage: https://github.com/wireapp/wire-webapp-cbor#readme
- Issues: https://github.com/wireapp/wire-webapp-cbor/issues
- npm.io page: https://npm.io/package/wire-webapp-cbor

## Recent versions

- 2.1.5 (latest) — 2017-09-01
- 2.1.4 — 2017-04-12
- 2.1.3 — 2017-04-07
- 2.1.2 — 2017-04-07
- 2.1.1 — 2017-04-07
- 2.1.0 — 2017-04-07
- 2.0.3 — 2017-04-06
- 2.0.2 — 2017-04-05
- 2.0.1 — 2017-03-31
- 2.0.0 — 2017-03-21
- 1.1.1 — 2016-12-06
- 1.1.0 — 2016-09-21

## README

# Wire

This repository is part of the source code of Wire. You can find more information at [wire.com](https://wire.com) or by contacting opensource@wire.com.

You can find the published source code at [github.com/wireapp](https://github.com/wireapp).

For licensing information, see the attached LICENSE file and the list of third-party licenses at [wire.com/legal/licenses/](https://wire.com/legal/licenses/).

## Status

[![Build Status](https://travis-ci.org/wireapp/wire-webapp-cbor.svg?branch=master)](https://travis-ci.org/wireapp/wire-webapp-cbor)
[![Release Status](https://badge.fury.io/js/wire-webapp-cbor.svg)](https://www.npmjs.com/package/wire-webapp-cbor)
[![Dependency Status](https://badges.greenkeeper.io/wireapp/wire-webapp-cbor.svg)](https://greenkeeper.io/)
[![Coverage Status](https://coveralls.io/repos/github/wireapp/wire-webapp-cbor/badge.svg?branch=master)](https://coveralls.io/github/wireapp/wire-webapp-cbor?branch=master)

## Installation

### Bower

```bash
bower install wire-webapp-cbor
```

### Yarn

```bash
yarn add wire-webapp-cbor
```

## Usage

### Browser

- [index.html](./dist/index.html)

### TypeScript

```typescript
import * as CBOR from 'wire-webapp-cbor';

const payload: Uint8Array = new Uint8Array([255, 18, 15, 34, 210, 168, 165, 188, 81, 33, 34, 40, 73, 61, 149, 198, 154, 54, 128, 76, 191, 161, 58, 176, 45, 75, 1, 33, 80, 157, 28, 89]);

// Encoding
const encoder: CBOR.Encoder = new CBOR.Encoder();
const encoded: ArrayBuffer = encoder.object(1)
                                    .u8(0)
                                    .bytes(payload)
                                    .get_buffer();

// Decoding
let decoded: Uint8Array;
const decoder: CBOR.Decoder = new CBOR.Decoder(encoded);
const properties: number = decoder.object();
for (let i = 0; i < properties; i++) {
  switch (decoder.u8()) {
    case 0:
      decoded = new Uint8Array(decoder.bytes());
      break;
    default:
      decoder.skip();
  }
}

// Comparison
const isEqual = decoded.every((row, index) => {
  return decoded[index] === payload[index];
});

console.log(isEqual); // true
```

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