plugin-data-persistence
plugin-data-persistence copied to clipboard
RangeError: Extra byte(s) found at buffer
Hi, I'm not sure that this issue depends on this plugin, but I want to know if there is a way to avoid it so we can track similar issues.
This problem is generated when I've tried to restore
a previously saved Lyra instance.
This is the code:
import { create, insert } from '@lyrasearch/lyra'
import { restoreFromFile, persistToFile } from '@lyrasearch/plugin-data-persistence'
const db = create({
schema: {
author: 'string',
quote: 'string'
}
})
insert(db, {
author: 'Poseidon',
quote: 'Sea'
})
persistToFile(db, 'binary', './test.msp')
const db2 = restoreFromFile('binary', './test.msp')
The error is present only with the binary
format which uses msgpack. There's another way to avoid it keep using binary
formats?