Skip to main content
Version: v0.0.3

Interface: EncoderOptions

Options for encodeFrame.

Example

const frame = encodeFrame(payload, {
allowDelimiterBytesInPayload: true,
onWarning: (w) => logger.warn(w),
});

Properties

allowDelimiterBytesInPayload?

optional allowDelimiterBytesInPayload?: boolean

When true, VT (0x0B) or FS (0x1C) bytes within the payload are preserved verbatim in the output frame instead of throwing MllpFramingError. An MllpWarning is emitted per offending byte if onWarning is provided.

Default: false (strict, throws on delimiter bytes).


onWarning?

optional onWarning?: (w) => void

Called for each offending delimiter byte when allowDelimiterBytesInPayload is true. Invocation is wrapped in try/catch, a throwing handler does not interrupt encoding.

Parameters

w

MllpWarning

Returns

void

Example

const frame = encodeFrame(payload, {
allowDelimiterBytesInPayload: true,
onWarning: (w) => logger.warn({ code: w.code, offset: w.byteOffset }),
});