-
-
Notifications
You must be signed in to change notification settings - Fork 12
Support buffer/Uint8Array prefixes #111
Comments
You wouldn't be able to use the full range of bytes, as two must be reserved for separator and |
The prefix separator is by default A more robust solution may use escaping applied to the prefix to always escape any occurrences of the prefix separator... Not sure what you mean by |
Sure, it's possible, at the cost of complexity. Can you explain your use case? I'm curious about the benefit of buffer prefixes, if you can't use the full range of bytes.
Not important for the discussion but FYI: subleveldown will throw a RangeError if you do that. |
I'm using subleveldown to store dynamic sub-levels. Depending on the usecase, I would prefer to use the name of the sublevel to be a raw buffer instead because sometimes I'm using the names as indexes. And the value I'm indexing on is itself a buffer. Right now it just involves converting to a string which seems unnecessary. However I guess a robust solution would require prefix-separator escaping. |
Wouldn't escaping hurt the ability to use it as an index? |
Only for the sublevel prefix/names. We're not affecting the keys. Not sure what you mean by hurting its ability to use it as an index. |
Can you share some code to clarify the use case? |
I want to use raw buffers as my prefixes, because I have some complex sublevel work going on.
Can we make subleveldown support buffers?
That is raw buffers so that the resulting prefix will just be a buffer concatenation, no encoding of the buffer as a string, then as utf8 encoded buffer. I just want the raw buffers to be the prefix itself.
The text was updated successfully, but these errors were encountered: