2.1.1 • Published 4 years ago

dm-codec v2.1.1

Weekly downloads
2
License
BSD
Repository
github
Last release
4 years ago

dm-codec

node.js package, wrapper around libdmtx for encoding and decoding datamatrix tags.

Install

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.

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 or Uint8Array.

It returns a text or throw an error:

  • text: the content of the datamatrix tag
2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago