Skip to content

Commit

Permalink
Use syntax highlighting in README
Browse files Browse the repository at this point in the history
  • Loading branch information
koraktor committed Aug 2, 2013
1 parent 8a6e7a8 commit ca6f4ee
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,27 @@ The Java-based implementation can use the

## Usage

require 'rbzip2'
```ruby
require 'rbzip2'
```

### Compression

data = some_data
file = File.new 'somefile.bz2' # open the target file
bz2 = RBzip2::Compressor.new file # wrap the file into the compressor
bz2.write data # write the raw data to the compressor
bz2.close # finish compression (important!)
```ruby
data = some_data
file = File.new 'somefile.bz2' # open the target file
bz2 = RBzip2::Compressor.new file # wrap the file into the compressor
bz2.write data # write the raw data to the compressor
bz2.close # finish compression (important!)
```

### Decompression

file = File.new 'somefile.bz2' # open a compressed file
bz2 = RBzip2::Decompressor.new file # wrap the file into the decompressor
data = io.read # read data into a string
```ruby
file = File.new 'somefile.bz2' # open a compressed file
bz2 = RBzip2::Decompressor.new file # wrap the file into the decompressor
data = io.read # read data into a string
```

## Future plans

Expand All @@ -54,12 +60,16 @@ The Java-based implementation can use the

To install RBzip2 as a Ruby gem use the following command:

gem install rbzip2
```sh
$ gem install rbzip2
```

To use it as a dependency managed by Bundler add the following to your
`Gemfile`:

gem 'rbzip2'
```ruby
gem 'rbzip2'
```

If you want to use the FFI implementation on any non-JRuby VM, be sure to also
install the `ffi` gem.
Expand Down

0 comments on commit ca6f4ee

Please sign in to comment.