Function NullTerminatedString

  • @NullTerminatedString decorator reads a string from a binary stream until the null-terminator (\0) character is encountered and exclude that character from the final value.

    Type Parameters

    • This extends object

      The type of the class the decorator is applied to.

    • Value

      The type of the decorated property.

    Parameters

    Returns DecoratorType<This, Value>

    The property decorator function.

    In the following example, the @NullTerminatedString decorator is used in conjunction of the @Until decorator to read Null terminated strings until the end of the file.

    class Protocol {
    @Until(EOF)
    @NullTerminatedString()
    data: string[]
    }