Skip to content

Commit

Permalink
Node: convert VerbatimString into Uint8Array (#1588)
Browse files Browse the repository at this point in the history
Node: convert `VerbatimString` into Uint8Array
  • Loading branch information
eifrah-aws committed Jun 18, 2024
1 parent fe82f1b commit 0369b9c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions node/rust-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,12 @@ fn redis_value_to_js(val: Value, js_env: Env) -> Result<JsUnknown> {
// "Normal client libraries may ignore completely the difference between this"
// "type and the String type, and return a string in both cases.""
// https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md
Value::VerbatimString { format: _, text } => js_env
.create_string_from_std(text)
.map(|val| val.into_unknown()),
Value::VerbatimString { format: _, text } => {
// VerbatimString is binary safe -> convert it into such
Ok(js_env
.create_buffer_with_data(text.as_bytes().to_vec())?
.into_unknown())
}
Value::BigNumber(num) => {
let sign = num.is_negative();
let words = num.iter_u64_digits().collect();
Expand Down

0 comments on commit 0369b9c

Please sign in to comment.