Skip to content

Add support for size calculation when writing #87

@rain1

Description

@rain1

Currently the serialization of json into object looks like this:

// template and obj definitions
const buffer = new ArrayBuffer(10);
const jbOut = new jBinary(buffer, template);
jbOut.write('parent', obj);

Problem is that if actual object is more than 10 bytes it gets: Uncaught RangeError: offset is outside the bounds of the DataView.

It would be cool if size calculation was included in jBinary so that I would not have to traverse the structure myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions