Interface: EncoderOptions
Options for encodeFrame.
Example
const frame = encodeFrame(payload, {
allowDelimiterBytesInPayload: true,
onWarning: (w) => logger.warn(w),
});
Properties
allowDelimiterBytesInPayload?
optionalallowDelimiterBytesInPayload?: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?
optionalonWarning?: (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
Returns
void
Example
const frame = encodeFrame(payload, {
allowDelimiterBytesInPayload: true,
onWarning: (w) => logger.warn({ code: w.code, offset: w.byteOffset }),
});