Created
July 22, 2015 14:14
-
-
Save yannick/63416d7173f542bb2edc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module holyzip; | |
| import std.zlib; | |
| ubyte[] zipS(string data) | |
| { | |
| return cast(ubyte[])std.zlib.compress(data); | |
| } | |
| string unzipS(ubyte[] data) | |
| { | |
| return cast(string) std.zlib.uncompress(cast(void[])data); | |
| } | |
| unittest | |
| { | |
| string test = "YOLO"; | |
| auto comp = test.zipS(); | |
| string res = comp.unzipS(); | |
| assert(res == "YOLO"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment