UNPKG

rtf-stream-parser

Version:

Stream Transform class to tokenize RTF, and another to de-encapsulate text or HTML

41 lines (40 loc) 1.98 kB
/// <reference types="node" /> import { DeEncapsulationGlobalState } from './features/handleDeEncapsulation.types'; import { FontTableEntry } from './features/handleFonts.types'; import { GlobalStateWithGroupState } from './features/handleGroupState.types'; import { FeatureHandler, WarnOption } from './features/types'; import { ProcessTokens } from './ProcessTokens'; import { ProcessTokensGlobalState, ProcessTokensGroupState, ProcessTokensOptions } from './ProcessTokens.types'; export declare type Mode = 'text' | 'html' | 'either'; declare type DeEncGroupState = ProcessTokensGroupState; interface DeEncGlobalState extends ProcessTokensGlobalState, DeEncapsulationGlobalState, GlobalStateWithGroupState<DeEncGroupState> { _options: DeEncapsulationGlobalState['_options'] & WarnOption['_options']; _state: DeEncGroupState; _rootState: DeEncGroupState; } interface DeEncapsulateExtraOptions { htmlEncodeNonAscii: boolean; htmlFixContentType: boolean; htmlPreserveSpaces: boolean; mode: Mode; prefix: boolean; outlookQuirksMode: boolean; } export declare type DeEncapsulateOptions = DeEncapsulateExtraOptions & ProcessTokensOptions; export declare class DeEncapsulate extends ProcessTokens implements DeEncGlobalState { _options: ProcessTokensOptions & DeEncapsulateExtraOptions; readonly _featureHandlers: FeatureHandler<ProcessTokensGlobalState>[]; readonly _rootState: DeEncGroupState; _state: DeEncGroupState; _fromhtml: boolean; _fromtext: boolean; _didHtmlCharsetReplace: boolean; _originalHtmlCharset: string | undefined; constructor(options?: Partial<DeEncapsulateOptions>); get isHtml(): boolean; get isText(): boolean; get originalHtmlCharset(): string | undefined; _getOutputAsString(data: string | Buffer, font?: FontTableEntry): [string, boolean]; _getCurrentFont(): FontTableEntry | undefined; } export default DeEncapsulate;