HELP: uncompress
{ $values
- { "compressed" compressed }
+ { "obj" { $or compressed byte-array } }
{ "byte-array" byte-array }
}
-{ $description "Uncompresses a compressed object, returning a byte-array of the underlying data." } ;
+{ $description "Uncompresses, returning a byte-array of the underlying data." } ;
ARTICLE: "compression.zlib" "Compression (ZLIB)"
"The " { $vocab-link "compression.zlib" } " vocabulary provides support for ZLIB:"
GENERIC: uncompress ( obj -- byte-array )
-M: compressed uncompress ( compressed -- byte-array )
+M: compressed uncompress
[
length>> [ <byte-vector> dup underlying>> ] keep
ulong <ref>
2drop ulong deref memory>byte-array
] with-destructors ;
-M: byte-array uncompress ( byte-array -- byte-array )
+M: byte-array uncompress
[ length 5 [0,b) [ 2^ * ] with map ] keep
'[ _ (uncompress) ] attempt-all ;