AnotherRedisDesktopManager icon indicating copy to clipboard operation
AnotherRedisDesktopManager copied to clipboard

pleaser support snappy uncompress

Open Hawken94 opened this issue 1 year ago • 4 comments

OS

Mac

VERSION

1.6.1

ISSUE DESCRIPTION

We use snappy to compress and uncompress the value, please support snappy! I try to use a custom formatter, but it doesn't work!

I go build https://github.com/golang/snappy to generate exec. And use /user_path/snappy -d {VALUE} or -d {HEX}, but they doesn't work! image

please have a look! thanks.

Hawken94 avatar Nov 11 '23 10:11 Hawken94

The hex representation needs to be converted into bytes and then passed to snappy. You can't pass {HEX} directly.

dlidstrom avatar Nov 13 '23 12:11 dlidstrom

The hex representation needs to be converted into bytes and then passed to snappy. You can't pass {HEX} directly.

Thanks to reply. I tried {VALUE}, it didn't work either. Can you tell me how to do? thanks.

Hawken94 avatar Nov 13 '23 13:11 Hawken94

The bytes will be passed like this: c0ed09.... I implemented support for LZ4 in C# like this:

using System.Text;
using K4os.Compression.LZ4;

// this converts the hex into bytes two chars at a time
byte[] bs =
  Enumerable.Range(0, args[0].Length)
    .Where(x => x % 2 == 0)
    .Select(x => Convert.ToByte(args[0].Substring(x, 2), 16))
    .ToArray();
string result = Encoding.UTF8.GetString(LZ4Pickler.Unpickle(bs));
Console.WriteLine(result);

dlidstrom avatar Nov 13 '23 13:11 dlidstrom

The bytes will be passed like this: c0ed09.... I implemented support for LZ4 in C# like this:

completely right, @Hawken94 the value passed to your script is hex value, you should convert it to bytes first

qishibo avatar Nov 14 '23 05:11 qishibo