Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 1.77 KB

README.md

File metadata and controls

53 lines (41 loc) · 1.77 KB

CodecBzip2.jl

codecov.io

Installation

Pkg.add("CodecBzip2")

Usage

using CodecBzip2

# Some text.
text = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean sollicitudin
mauris non nisi consectetur, a dapibus urna pretium. Vestibulum non posuere
erat. Donec luctus a turpis eget aliquet. Cras tristique iaculis ex, eu
malesuada sem interdum sed. Vestibulum ante ipsum primis in faucibus orci luctus
et ultrices posuere cubilia Curae; Etiam volutpat, risus nec gravida ultricies,
erat ex bibendum ipsum, sed varius ipsum ipsum vitae dui.
"""

# Streaming API.
stream = Bzip2CompressorStream(IOBuffer(text))
for line in eachline(Bzip2DecompressorStream(stream))
    println(line)
end
close(stream)

# Array API.
compressed = transcode(Bzip2Compressor, text)
@assert sizeof(compressed) < sizeof(text)
@assert transcode(Bzip2Decompressor, compressed) == Vector{UInt8}(text)

This package exports following codecs and streams:

Codec Stream
Bzip2Compressor Bzip2CompressorStream
Bzip2Decompressor Bzip2DecompressorStream

See docstrings and TranscodingStreams.jl for details.