node-bcc
Version:
A simple Block Check Character library.
64 lines (63 loc) • 1.46 kB
TypeScript
/// <reference types="node" />
/**
* This class provides methods for calculating the Block Check Character of a
* message.
*
* @export
* @class Bcc
*/
export declare class Bcc {
/**
* This function calculates a Block Check Character for the given array of
* strings.
*
* ### Example
*
* ``` ts
* console.log(calculateBcc(['01', '02', '03', '04']));
* ```
*
* ### Output
* `4`
*
* @static
* @param message The bytes of the message as a hex string array.
* @returns The calculated BCC.
*/
static calculate(message: string[]): number;
/**
* This function calculates a Block Check Character for the given array of
* numbers.
*
* ### Example
*
* ``` ts
* console.log(Bcc.calculate([1, 2, 3, 4]));
* ```
*
* ### Output
* `4`
*
* @static
* @param message The bytes of the message as a number array.
* @returns The calculated BCC.
*/
static calculate(message: number[]): number;
/**
* This function calculates a Block Check Character for the buffer.
*
* ### Example
*
* ```ts
* console.log(Bcc.calculate(Buffer.from([1, 2, 3, 4])))
* ```
*
* ### Output
* `4`
*
* @static
* @param message The bytes of the message as a buffer.
* @returns The calculated BCC.
*/
static calculate(message: Buffer): number;
}