Skip to content

Instantly share code, notes, and snippets.

@horatio-sans-serif
Created May 7, 2010 14:32
Show Gist options
  • Save horatio-sans-serif/393489 to your computer and use it in GitHub Desktop.
Save horatio-sans-serif/393489 to your computer and use it in GitHub Desktop.
They both write the same value when the node script uses a Buffer.
~/Downloads/2010-05-07/compatibility_issue ⚡ redis-cli flushall
OK
~/Downloads/2010-05-07/compatibility_issue ⚡ !node
node write_file_to_redis.js 2> output.node
~/Downloads/2010-05-07/compatibility_issue ⚡ redis-cli get test_key
"\x1f\x8b\b\b\x80\xce\xe3K\x00\x03testfile.txt\x00\x0b\xc9\xc8,V\x00\xa2\xe2\xfc\xdcT\x85\x94\xc4\x92D\x85\x92\x8c\xc4\x12\x90Hz~f^\xbaBI\xbeBR\xaaBr~nAQjqqj\n\x17\x00\xc8\xcerT1\x00\x00\x00"
~/Downloads/2010-05-07/compatibility_issue ⚡ !python
python write_file_to_redis.py > output.python
~/Downloads/2010-05-07/compatibility_issue ⚡ redis-cli get test_key
"\x1f\x8b\b\b\x80\xce\xe3K\x00\x03testfile.txt\x00\x0b\xc9\xc8,V\x00\xa2\xe2\xfc\xdcT\x85\x94\xc4\x92D\x85\x92\x8c\xc4\x12\x90Hz~f^\xbaBI\xbeBR\xaaBr~nAQjqqj\n\x17\x00\xc8\xcerT1\x00\x00\x00"
~/Downloads/2010-05-07/compatibility_issue ⚡ diff output
output.node output.python
~/Downloads/2010-05-07/compatibility_issue ⚡ diff output.*
~/Downloads/2010-05-07/compatibility_issue ⚡ echo $?
0
with some changes, it works the same for binary strings:
~/Downloads/2010-05-07/compatibility_issue ⚡ redis-cli flushall
OK
~/Downloads/2010-05-07/compatibility_issue ⚡ node write_file_to_redis.js
len = 78
~/Downloads/2010-05-07/compatibility_issue ⚡ redis-cli get test_key > a
~/Downloads/2010-05-07/compatibility_issue ⚡ python write_file_to_redis.py > output.python
~/Downloads/2010-05-07/compatibility_issue ⚡ redis-cli get test_key > b
~/Downloads/2010-05-07/compatibility_issue ⚡ diff a b
~/Downloads/2010-05-07/compatibility_issue ⚡ echo $?
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment