Skip to content

Instantly share code, notes, and snippets.

@yannick
Created July 22, 2015 14:14
Show Gist options
  • Select an option

  • Save yannick/63416d7173f542bb2edc to your computer and use it in GitHub Desktop.

Select an option

Save yannick/63416d7173f542bb2edc to your computer and use it in GitHub Desktop.
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