{"id":18103137,"url":"https://github.com/koraktor/rbzip2","last_synced_at":"2025-04-13T19:01:31.024Z","repository":{"id":1815900,"uuid":"2740081","full_name":"koraktor/rbzip2","owner":"koraktor","description":"bzip2 for Ruby","archived":false,"fork":false,"pushed_at":"2018-05-15T23:00:33.000Z","size":134,"stargazers_count":40,"open_issues_count":1,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T09:45:37.007Z","etag":null,"topics":["bzip2","compression","decompression","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"CPAN-API/cpan-api","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koraktor.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-11-09T07:38:32.000Z","updated_at":"2023-06-22T20:18:55.000Z","dependencies_parsed_at":"2022-08-19T22:30:16.154Z","dependency_job_id":null,"html_url":"https://github.com/koraktor/rbzip2","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koraktor%2Frbzip2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koraktor%2Frbzip2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koraktor%2Frbzip2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koraktor%2Frbzip2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koraktor","download_url":"https://codeload.github.com/koraktor/rbzip2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248766728,"owners_count":21158301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bzip2","compression","decompression","ruby"],"created_at":"2024-10-31T22:10:27.556Z","updated_at":"2025-04-13T19:01:30.978Z","avatar_url":"https://github.com/koraktor.png","language":"Ruby","readme":"RBzip2\r\n======\r\n\r\nRBzip2 is a gem providing various implementations of the [bzip2][bzip2]\r\nalgorithm used for compression and decompression. Currently, it includes a\r\n[FFI][ffi]-based implementation and a pure Ruby implementation that's slower\r\nbut works on any Ruby VM. Additionally, there's a JRuby specific implementation\r\nthat's based on Commons Compress.\r\n\r\nThe pure Ruby implementations is based on the code of the\r\n[Apache Commons Compress][commons] project and adds a straight Ruby-like API.\r\nThere are no external dependencies like other gems or libraries. Therefore it\r\nwill run on any Ruby implementation and the respective operating systems\r\nsupported by those implementations.\r\n\r\nThe FFI implementation is using `libbz2` and provides fast performance on\r\nplatforms where both `libbz2` and FFI are available. It is derived from this\r\n[Gist by Brian Lopez][gist].\r\n\r\nThe Java-based implementation can use the\r\n[Commons Compress Java library][commons] if it is available in the classpath.\r\n\r\n## Features\r\n\r\n * Compression of raw data into bzip2 compressed `IO`s (like `File` or\r\n   `StringIO`)\r\n * Decompression of bzip2 compressed `IO`s (like `File` or `StringIO`)\r\n\r\n## Usage\r\n\r\n```ruby\r\nrequire 'rbzip2'\r\n```\r\n\r\n### Compression\r\n\r\n```ruby\r\ndata = some_data\r\nfile = File.new 'somefile.bz2'      # open the target file\r\nbz2  = RBzip2.default_adapter::Compressor.new file  # wrap the file into the compressor\r\nbz2.write data                      # write the raw data to the compressor\r\nbz2.close                           # finish compression (important!)\r\n```\r\n\r\n### Decompression\r\n\r\n```ruby\r\nfile = File.new 'somefile.bz2'        # open a compressed file\r\nbz2  = RBzip2.default_adapter::Decompressor.new file  # wrap the file into the decompressor\r\ndata = io.read                        # read data into a string\r\n```\r\n\r\n## Future plans\r\n\r\n * Simple decompression of strings\r\n * Simple creation of compressed files\r\n * Two-way compressed IO that will (de)compress as you read/write\r\n\r\n## Installation\r\n\r\nTo install RBzip2 as a Ruby gem use the following command:\r\n\r\n```sh\r\n$ gem install rbzip2\r\n```\r\n\r\nTo use it as a dependency managed by Bundler add the following to your\r\n`Gemfile`:\r\n\r\n```ruby\r\ngem 'rbzip2'\r\n```\r\n\r\nIf you want to use the FFI implementation on any non-JRuby VM, be sure to also\r\ninstall the `ffi` gem.\r\n\r\n## Performance\r\n\r\nThe `bzip2-ruby` gem is a Ruby binding to `libbz2` and offers best performance,\r\nbut it is only available for MRI \u003c 2.0.0 and Rubinius.\r\n\r\nThe FFI implementation binds to `libbz2` as well and has almost the same\r\nperformance as `bzip2-ruby`.\r\n\r\nThe Java implementation uses a native Java library and is slower by a factor of\r\nabout 2/10 while compressing/decompressing.\r\n\r\nThe pure Ruby implementation of RBzip2 is inherently slower than `bzip2-ruby`.\r\nCurrently, this is a plain port of Apache Commons' Java code to Ruby and no\r\neffort has been made to optimize it. That's why the Ruby implementation of\r\nRBzip2 is slower by a factor of about 130/100 while compressing/decompressing\r\n(on Ruby 1.9.3). Ruby 1.8.7 is even slower.\r\n\r\n## License\r\n\r\nThis code is free software; you can redistribute it and/or modify it under the\r\nterms of the new BSD License. A copy of this license can be found in the\r\nincluded LICENSE file.\r\n\r\n## Credits\r\n\r\n* Sebastian Staudt -- koraktor(at)gmail.com\r\n* Brian Lopez -- seniorlopez(at)gmail.com\r\n\r\n## See Also\r\n\r\n* [Documentation](http://rubydoc.info/gems/rbzip2)\r\n* [GitHub project page](https://github.com/koraktor/rbzip2)\r\n* [bzip2 project page][bzip2]\r\n\r\n [bzip2]:   http://bzip.org\r\n [commons]: http://commons.apache.org/compress\r\n [ffi]:     https://github.com/ffi/ffi/wiki\r\n [gist]:    https://gist.github.com/brianmario/5833373\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoraktor%2Frbzip2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoraktor%2Frbzip2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoraktor%2Frbzip2/lists"}