CodecZlib.jl
CodecZlib.jl copied to clipboard
transcode failing if codec is initialized
This looks current in the doc, but no longer (I believe this is a pattern I used before) works for me:
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.3.0 (2019-11-26)
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
|__/ |
julia> using Pkg; Pkg.status()
Project HH v0.1.0
Status `~/src/bitbucket.org/garborg/HH/Project.toml`
[4f18b42c] BusinessDays v0.9.6
[944b1d66] CodecZlib v0.6.0
[34da2185] Compat v3.2.0
[864edb3b] DataStructures v0.17.9
[cd3eb016] HTTP v0.8.8
[682c06a0] JSON v0.21.0
[6ac74813] MD5 v0.2.1
[295af30f] Revise v2.5.0
[ade2ca70] Dates
julia> using CodecZlib: transcode, GzipCompressor
julia> bytes = codeunits("asfjkl")
6-element Base.CodeUnits{UInt8,String}:
0x61
0x73
0x66
0x6a
0x6b
0x6c
julia> transcode(GzipCompressor, bytes)
26-element Array{UInt8,1}:
0x1f
0x8b
0x08
0x00
0x00
0x00
0x00
0x00
0x00
0x03
0x4b
0x2c
0x4e
0xcb
0xca
0xce
0x01
0x00
0x75
0x9e
0x18
0x55
0x06
0x00
0x00
0x00
julia> transcode(GzipCompressor(), bytes)
ERROR: zlib error: <no message> (code: -2)
Stacktrace:
[1] transcode(::GzipCompressor, ::Base.CodeUnits{UInt8,String}) at /home/sean/.julia/packages/TranscodingStreams/MsN8d/src/transcode.jl:121
[2] top-level scope at REPL[5]:1
I'm having the same issue. Had you found any solutions?
I didn't, other than using transcode(GzipCompressor, bytes)
(forgoing tuning the parameters) or shelling out. I'm not actually using it now, so I didn't dig.
The docs could use updating, I found the following by inspecting https://github.com/JuliaIO/TranscodingStreams.jl
gzip = GzipCompressor(level=9)
initialize(gzip) # required
transcode(gzip, bytes)
finalize(gzip) # required