Added compressToCustom and decompressFromCustom function#183
Added compressToCustom and decompressFromCustom function#183Rycochet merged 9 commits intopieroxy:masterfrom
Conversation
…m designed characters for compression.
|
Can this be updated to the new split file version - should be relatively easy to do - testing is getting improvements but the basic pattern is in there! |
|
Yes, looking into it. Hopefully this weekend. |
|
Hey, I hope this will work for you. |
|
Only thing blocking this is getting the tests to use the same boilerplate as elsewhere - trying to figure out how to add this to the commandline code (still working on that so don't worry about adding it yourself!) |
|
I didn't use |
I've replied on the thread, hopefully it makes more sense now :-) |
|
Also note that we've got a consistent license header on all other files now, can you add that to your new ones :-) |
|
Next try. Hopefully it works now. Found a missing typing for compressToCustom. Seems like TypeScript and testing is useful after all. I tried to create a test case with an 13-character heterogram ( Just FYI, for the testing it is not important. Edit: And another missing typing... don't know why the error wasn't triggered eartlier... |
| describe("23 letter heterogram", () => { | ||
| const heterogram = "BlockyDwarfZingsTheJump"; | ||
| const compress = (input: string | null) => compressToCustom(input, heterogram); | ||
| const decompress = (input: string | null) => decompressFromCustom(input, heterogram); | ||
|
|
||
| runTestSet<string>(compress, decompress, ""); | ||
| }); |
|
The size test is probably not important - I'm moving over to only testing known output and making sure that the raw data is hashed and known correct - should have that merged later tonight, which will give us a better testing base :-) |
|
Sorry, I am a little bit confused. How to use this modification? I thought it added I want it mainly for this issue #182 (I mean if this modification solves it) |
|
@marwan-nwh How did you install it? v2 (that this is part of) is not currently released to npm so you need to install manually. |
Got it, thanks! |
|
Can you elaborate on the found problem? Anything I can do to help? |
|
@HelloLudger I've created a draft PR with more detail and an easier way to test it - #200 - hope that helps! |
as discussed in / (maybe) useful for
It basically works similar to
...Uint8Array(), first compressing everything and then figuring out, how the UTF-16 characters can be stored with the provided dictionary(-string).I couldn't make the
_compress/_decompressroute work, because the custom dictionary length is often not 2^something, so_decompresswouldn't work (or_compresswould only use a subset of the provided characters).