Skip to content

JuliaIO/CodecBzip2.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodecBzip2.jl

CI codecov

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.