How are Buffers converted to string internally?
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Comienza con el código stream-write referenciado de index.js y el ejemplo enlazado de node-redis-test; después, sigue cómo el cliente gestiona un Buffer frente a Buffer.toString(). Compara los valores de Redis observados con las versiones de Node.js y Redis indicadas. Se considerará terminado cuando se documente el comportamiento de conversión y por qué difieren los dos valores almacenados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I apologize in advance for asking the question here - I've originally posted my question on stackoverflow, but after 10 days I still didn't manage to get the answer that I was looking for... I thought I might try my luck here 😄. If it's not ok to ask the question here, let me know and I'll remove it...
I'm not having any issues with the library, but I'm trying to figure out how Buffer is being handled in node-redis library. I have my nodejs script that fetches some data from database, serializes and gzips the result and then stores that result in redis. Later I read this value in php script, so I need to match what php script expects
In node gzip library returns Buffer and what I'm wondering is how does node-redis convert this Buffer to string internally?
When I pass Buffer (from gzip) to redis, it will be saved in the format that my php script can read and decode properly
await client.setex('compressed', 3600, compressed);
Value in redis (result is from redis desktop manager terminal)
redis1:0>get "compressed'
"\x1F\x8B\x08\x00\x00\x00\x00\x00\x02\x03\xABVJI,IT\xB2R*I-.Q\xAA\x05\x00\xC0\xE3/\xAC\x0F\x00\x00\x00"
But when I pass Buffer.toString() to redis, php won't be able to read and decode
await client.setex('compressed', 3600, compressed.toString());
Value in redis
redis1:0>get "compressed-toString"
"\x1F\xEF\xBF\xBD\x08\x00\x00\x00\x00\x00\x02\x03\xEF\xBF\xBDVJI,IT\xEF\xBF\xBDR*I-.Q\xEF\xBF\xBD\x05\x00\xEF\xBF\xBD\xEF\xBF\xBD/\xEF\xBF\xBD\x0F\x00\x00\x00"
Now I'm trying to figure out how exactly is node-redis converting this buffer to string internally? Why are these 2 values different? Best that I could find is this stream write, but I'm still not clear on how exactly it works and why are the redis values different...
Any help is appreciated!
Test example
I've created simple example
Environment
-
Node.js Version:
v12.18.3 -
Redis Version:
5.0.5(redis:5.0.5-alpine) -
Platform:
Ubuntu 20.04
- Lenguaje dominante
- TypeScript
- Estrellas
- 17.6k
- Forks
- 2k
- Merge medio
- 1 d 22 h
- PR fusionados (30 d)
- 62
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de redis/node-redis
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
redis/node-redis#3664 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
After a MOVING handoff, a client never becomes ready again on reconnectPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
redis/node-redis#3705 ·
Los mantenedores suelen responder en 1 día
-
accepted Bug
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
redis/node-redis#3674 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Support Uint8Array values for zero-copy transfer to worker_threadsPosiblemente ocupada @umeshmore45 la tomó hace 286 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
redis/node-redis#3106 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
`RedisClientType` type is slow to typecheck (TS performance issue)Quizá libre de nuevo @nkaradzhov la tomó hace 556 días y no hay ningún pull request abierto. AbiertoBug
redis/node-redis#2975 · 30 comentarios · 27 reacciones · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de redis/node-redis
Issues similares
-
dependencies effort: small good first issue priority: low
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
TMHSDigital/screencast-mcp#509 ·
Los mantenedores suelen responder en 1 día
-
from-review tech-debt testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
blamechris/chroxy#9520 ·
Los mantenedores suelen responder en 1 día
-
area:web complexity:S priority:P2 type:chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nahuelcostac/agent-hub#104 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
snaglet-org/snaglet#78 ·
Los mantenedores suelen responder en 1 día
-
agent/guide documentation help wanted stage/010-actionable
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
kubestellar/console-marketplace#1101 ·
Los mantenedores suelen responder en 1 día