Datamatrix codec, wrapper around libdmtx.
npm install dm-codecnode.js package, wrapper around libdmtx for encoding and decoding datamatrix tags.
This package depends on libdmtx being installed and available on your system. You can find instructions on how to install it here. After that is installed, proceed with...
```
npm install dm-codec
Note for OSX users: you can alternatively use brew install libdmtx.
``
const dmCodec = require("dm-codec");
``
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
```
dmCodec.decode({
width: colsCount,
height: rowsCount,
data: pixels,
...otherOptions
});
where data is a Buffer or Uint8Array.
It returns a text or throw an error:
* text: the content of the datamatrix tag