Skip to content

Instantly share code, notes, and snippets.

@itamarhaber
Last active May 16, 2019 17:27
Show Gist options
  • Save itamarhaber/b5c584b75be26f59bf6d to your computer and use it in GitHub Desktop.
Save itamarhaber/b5c584b75be26f59bf6d to your computer and use it in GitHub Desktop.
Loading a binary value from a file with redis-cli

Create the file with the actual bytes, not the '\xnn\ representation. For example, in Python:

f = open('filename', 'w')
f.write('\x01\x02\x03')
f.close()

Load the file with redis-cli -x set keyname < filename

Create a script with the data already in it:

redis.call('SET', 'keyname', '\01\02\03')

Run the script: `redis-cli --eval script.lua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment