Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Parser

A data string parser.

Parsers are capable of parsing one particular data format, which is passed to them during construction.

The parser is created through BarcodePicker.createParserForFormat or Scanner.createParserForFormat.

Note that you need to have a valid license key with the parsing feature enabled to use the parser functionalities.

For documentation on the available formats, check the official parser library documentation here: https://docs.scandit.com/parser/formats.html.

Hierarchy

  • Parser

Index

Methods

parseRawData

  • Process the given raw (byte array) data with the parser, retrieving the result as a ParserResult object.

    Multiple requests done without waiting for previous results will be queued and handled in order.

    If parsing of the data fails the returned promise is rejected with a ScanditEngineError error.

    Parameters

    • rawData: Uint8Array

      The raw (byte array) data to be parsed.

    Returns Promise<ParserResult>

    A promise resolving to the ParserResult object.

parseString

  • Process the given string data with the parser, retrieving the result as a ParserResult object.

    Multiple requests done without waiting for previous results will be queued and handled in order.

    If parsing of the data fails the returned promise is rejected with a ScanditEngineError error.

    Note that you should use parseRawData whenever possible: some codes, such as those found on driving licenses, might have non-printable characters and will need to use Barcode.rawData information to be parsed correctly.

    Parameters

    • data: string

      The string data to be parsed.

    Returns Promise<ParserResult>

    A promise resolving to the ParserResult object.

setOptions

  • setOptions(options?: undefined | object): void
  • Apply the option map to the parser, allowing the user to fine-tune the behaviour of the parser. Available options depend on the data format and are specified in the respective documentation.

    Parameters

    • Optional options: undefined | object

      The new options to be applied (replacing previous ones, if any).

    Returns void

Generated using TypeDoc