Skip to content

"Data read, but end of buffer not reached [64]" when using structures #164

@shirecoding

Description

@shirecoding

Im not sure if this is the right way, but when i add the structure methods i get an error

let packr = new Packr({
    useRecords: true,
    // Enable saving/restoring structures
    getStructures() {
        return this.structures || [];
    },
    saveStructures(structures) {
        this.structures = structures;
    },
});

or alternatively

let packr = new Packr({
    useRecords: true,
    structures: [["event", "type", "message"]], // my data is a list of objects
});
231 |                   restoreStructures()
232 |           clearSource()
233 |           if (error instanceof RangeError || error.message.startsWith('Unexpected end of buffer') || position > srcEnd) {
234 |                   error.incomplete = true
235 |           }
236 |           throw error
              ^
error: Data read, but end of buffer not reached [64]
      at checkedRead (/Users/benjaminhon/Developer/christmas/christmas/app/node_modules/msgpackr/unpack.js:236:9)

I am on version: "msgpackr": "^1.11.2",

It works if i remove it. But what i want to acheive is having the records shared across multiple calls to packr.pack(data)

Im not sure why but i suspect that structures only work with dicts and not list of dicts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions