UNPKG

@hamstudy/flamp

Version:

JavaScript Amateur Multicast Protocol AMP-2 Version 3 Implemented from specification document http://www.w1hkj.com/files/flamp/Amp-2.V3.0.Protocol.pdf • Version 1.0.0 - W5ALT, Walt Fair, Jr. (Derived From) • Version 2.0.0 - W1HKJ, Dave Freese, w

91 lines (90 loc) 2.6 kB
import { Block } from './block'; export declare const lzmaCompressedPrefix = "\u0001LZMA"; export declare const MODIFIED_TIME_REGEX: RegExp; /** * Takes a date and returns a string in format YYYYMMDDhhmmss */ export declare function dateToString(d: Date): string; /** * Takes a string in format YYYYMMDDhhmmss and returns a date */ export declare function stringToDate(str: string): Date; export declare function uint8ToBinaryString(bytes: Uint8Array): string; export declare enum LTypes { FILE = "FILE", ID = "ID", SIZE = "SIZE", DESC = "DESC", DATA = "DATA", PROG = "PROG", CNTL = "CNTL" } export declare enum ControlWord { EOF = "EOF", EOT = "EOT" } export declare enum BaseEncode { b64 = "base64", b91 = "base91" } export declare enum CompressionType { LZMA = "LZMA" } export interface IOptions { compression?: CompressionType | false; forceCompress?: boolean; base?: BaseEncode; fromCallsign?: string; toCallsign?: string; filename: string; fileDescription?: string; fileModifiedTime: Date; inputBuffer: string; blkSize: number; skipProgram?: boolean; useEOF?: boolean; useEOT?: boolean; } export declare class Amp { static toString(blocks: Amp['blocks'], fromCallsign?: string, toCallsign?: string): string; static getHash(filename: string, modified: Date, compressed: boolean, baseConversion: BaseEncode | '', blockSize: number): string; fromCallsign: string | null; toCallsign: string | null; filename: string; fileDescription: string; fileModifiedTime: Date; inputBuffer: string; blkSize: number; PROGRAM: string; VERSION: string; base: '' | BaseEncode; compression: CompressionType | false; private forceCompress; blocks: { [LTypes.PROG]?: Block; [LTypes.ID]?: Block; [LTypes.FILE]?: Block; [LTypes.DESC]?: Block; [LTypes.SIZE]?: Block; [key: number]: Block; [ControlWord.EOF]?: Block; [ControlWord.EOT]?: Block; }; hash: string; private dataBlockCount; private skipProgram; private useEOF; private useEOT; private receivedFiles; constructor(opts: IOptions); makeBlocks(): void; toString(dataBlockList?: number[], includeHeaders?: boolean): string; getDataBlockCount(): number; /** * The base to use for transmitting the data, if any * @param base base64 or base91 */ setBase(base: '' | BaseEncode): void; baseEncode(base: BaseEncode, data: Uint8Array): string; quantizeMessage(): number; }