Skip to content

Option to fill in zero bytes for fixed size data types when undefined? #81

@LiamKarlMitchell

Description

@LiamKarlMitchell

Oh, sorry about custom type it is just an example, I think this should be an option for any type that can have a count set to a fixed number.

If you have a definition with a fixed size.

{
  "name": "foo",
  "type": [
    "fcstring",
    {
      "count": 4,
      "trim": true
    }
  ]
}

And wanted to serialize some object where it is undefined
{}

Then the buffer should zero fill.

<Buffer 00 00 00 00>

Example with buffer data type.

{
  "name": "foo",
  "type": [
    "buffer",
    {
      "count": 4
    }
  ]
}

<Buffer 00 00 00 00>

And applicable to arrays as well.

Would such an option be possible?
Maybe when setting up the serializer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions