• @Until decorator read variable length array that end by a special character or magic number.

    The difference between Until and Count is that this decorator accept to create arrays of undefined length.

    Type Parameters

    • This
    • Value

    Parameters

    • cmp: string | number | typeof EOF

      Continue reading/writting the binary file until the argument is reached.

    • Optionalopt: Partial<ControllerOptions>

    Returns DecoratorType<This, Value>

    The property decorator function ran at runtime

    This decorator can be used to read null terminated strings.

    class BinProtocol {
    @Until('\0')
    @Relation(PrimitiveSymbol.char)
    message: string // Null terminated string
    }

    You can use this decorator to read relation or primitive until the EOF.

    class BinProtocol {
    @Until(EOF)
    @Relation(PrimitiveSymbol.u8)
    array: number[]
    }

    This decorator doesn't accept a function as argument. If you need to use a function to verify an equality based on the currently read value use the While decorator instead.