rtf-stream-parser
Version:
Stream Transform class to tokenize RTF, and another to de-encapsulate text or HTML
33 lines (32 loc) • 1.57 kB
TypeScript
/// <reference types="node" />
import { Transform } from 'stream';
import { FontTable, FontTableEntry } from './features/handleFonts.types';
import { FeatureHandler } from './features/types';
import { ProcessTokensGlobalState, ProcessTokensGroupState, ProcessTokensOptions } from './ProcessTokens.types';
import { Token } from './tokenize';
export declare const procTokensDefaultOptions: ProcessTokensOptions;
export declare abstract class ProcessTokens extends Transform implements ProcessTokensGlobalState {
_options: ProcessTokensOptions;
readonly _featureHandlers: FeatureHandler<ProcessTokensGlobalState>[];
readonly _rootState: ProcessTokensGroupState;
_state: ProcessTokensGroupState;
_cpg: number;
_count: number;
_lastLastToken: Token | null | undefined;
_lastToken: Token | null | undefined;
_currToken: Token | null | undefined;
_done: boolean;
_ansicpg: boolean;
_deff: string;
_fonttbl: FontTable | undefined;
_skip: number;
constructor(options?: Partial<ProcessTokensOptions>);
get defaultCodepage(): number;
_getOutputAsString(data: string | Buffer, font: FontTableEntry | undefined): [string, boolean];
_pushOutputData(outStr: string, areSymbolFontCodepoints: boolean): void;
_getCurrentFont(): FontTableEntry | undefined;
_pushOutput(data: Buffer | string): void;
_handleToken(token: Token): void;
_transform(token: Token, encoding: string | undefined, cb: (error?: any) => void): void;
_flush(cb: (error?: any) => void): void;
}