Closed vweevers closed 5 years ago
We can't do it exactly the way I proposed in https://github.com/Level/memdown/issues/186#issuecomment-520126288:
In level-js, store strings as (array)buffers
Because not all runtime environments support binary keys. In those we must use string keys only.
I'm thinking we'll replace:
https://github.com/Level/level-js/blob/86dd5e76b355c49b20d55c6d86c66381ad5cfd13/index.js#L143-L151
With:
Level.prototype._serializeKey = function (key) {
if (Level.binaryKeys) {
return Buffer.isBuffer(key) ? key : Buffer.from(String(key))
} else {
return String(key)
}
}
Also try to find a way to support reading/migrating existing data (that was stored as a string).
Background: https://github.com/Level/memdown/issues/186.