Skip to content

Buffer to Value#

It transforms a Buffer object into a different type. The available types are Integer, StringUTF8, StringASCII, StringUTF16LE, StringBase64. It uses the .toString() and the .readIntBE() javascript function.

Settings#

Name Data Type Possible Values Description
type Enum StringASCII
StringUTF8
StringUTF16LE
StringBase64
StringHex
Integer
UnsignedInteger
Float
Double
Formatter to use to convert the value

Table 1: Settings

image123

Examples#

Input buffer (hex / encoding) type Output
00 00 00 01 Integer 1
00 00 00 7F UnsignedInteger 127
12 34 56 78 StringHex 12345678
UTF-8 bytes of "Hello" StringUTF8 Hello
ASCII bytes of "Hello" StringASCII Hello
UTF-16 LE bytes of "Hello" StringUTF16LE Hello
Base64-decoded bytes of "abcdefg12345" StringBase64 abcdefg12345
4-byte buffer written with writeFloatBE(3.14) Float ≈ 3.14
8-byte buffer written with writeDoubleBE(3.14159) Double ≈ 3.14159

Table 2: Examples

Invalid Configuration#

This converter fails in the case below. It also fails when the input buffer is shorter than the selected type's minimum size (see note at the end of this section). For what happens to the rest of the chain when a converter fails (the error is logged, reported for monitoring, and the next task does not run), see Converters.

type Result
UnsupportedType Fails with Not implemented yet.

Table 3: Invalid Configuration

The conversion is size-sensitive: Float requires at least 4 bytes, Double at least 8 bytes. Providing a shorter buffer causes the converter to fail.