import * as lmdb from "lmdb-store";
let store = lmdb.open("cache", {
name: "cache",
encoding: "binary",
});
await store.put("x", new Uint8Array([1,2,3]));
console.log(store.get("x"));
(at least for Uint8Array, since Buffer is compatible with that. Not so sure about other typed arrays)
So I'd suggest instead checking value instanceof Uint8Array (or even replacing the value.readUInt16BE since Buffers are subclasses: (Buffer.from("abc") instanceof Uint8Array) === true
It would be great if this worked:
(at least for Uint8Array, since Buffer is compatible with that. Not so sure about other typed arrays)
This is currently prevented by at least this check https://github.com/DoctorEvidence/lmdb-store/blob/33c3101b825750b45d301f4b3db58900943b9a0b/index.js#L508-L509 but it seems to work fine when commenting that line out.
So I'd suggest instead checking
value instanceof Uint8Array
(or even replacing thevalue.readUInt16BE
since Buffers are subclasses:(Buffer.from("abc") instanceof Uint8Array) === true