# dm-codec

> Datamatrix codec, wrapper around libdmtx.

Latest version **2.1.1** (published 2020-03-25) · BSD license · 0 weekly downloads

## Install

```sh
npm install dm-codec
pnpm add dm-codec
yarn add dm-codec
bun add dm-codec
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.1 |
| Published | 2020-03-25 |
| First published | 2020-03-20 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Maintainers | k.cai |
| Keywords | datamatrix |

## Links

- npm: https://www.npmjs.com/package/dm-codec
- Repository: https://github.com/flowkscai/dm-codec
- Issues: https://github.com/flowkscai/dm-codec/issues
- npm.io page: https://npm.io/package/dm-codec

## Dependencies (2)

- [bindings](https://npm.io/package/bindings.md) ^1.5.0
- [node-addon-api](https://npm.io/package/node-addon-api.md) ^2.0.0

## Recent versions

- 2.1.1 (latest) — 2020-03-25
- 2.1.0 — 2020-03-23
- 2.0.0 — 2020-03-20

## README

# dm-codec

node.js package, wrapper around [libdmtx](http://libdmtx.sourceforge.net/) for encoding and decoding datamatrix tags.

## Install

This package depends on [libdmtx](http://libdmtx.sourceforge.net/) being installed and available on your system. You can find instructions on how to install it [here](http://libdmtx.wikidot.com/general-instructions). After that is installed, proceed with...

```
npm install dm-codec
```

Note for OSX users: you can alternatively use `brew install libdmtx`.

## Usage

```
const dmCodec = require("dm-codec");
```

### Encoding

```
dmCodec.encode("The text to encode in a datamatrix");
```

It returns an object with the following properties:

* data: an array of pixels representing the datamatrix tag
* width: the width of the resulting pixels
* height: the height of the resulting pixels
* channels: the channels count of the resulting pixels

### Decoding

```
dmCodec.decode({
  width: colsCount,
  height: rowsCount,
  data: pixels,
  ...otherOptions
});
```

where data is a [Buffer](https://nodejs.org/api/buffer.html) or [Uint8Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array).

It returns a text or throw an error:

* text: the content of the datamatrix tag

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