{"id":16981356,"url":"https://github.com/charonn0/rb-bzip2","last_synced_at":"2026-03-18T23:03:48.801Z","repository":{"id":145922972,"uuid":"161879683","full_name":"charonn0/RB-bzip2","owner":"charonn0","description":"A Realbasic and Xojo binding to libbzip2","archived":false,"fork":false,"pushed_at":"2024-07-07T22:44:01.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-19T14:52:38.559Z","etag":null,"topics":["bzip2","compression","realbasic","xojo"],"latest_commit_sha":null,"homepage":"","language":"REALbasic","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charonn0.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"charonn0"}},"created_at":"2018-12-15T07:07:03.000Z","updated_at":"2024-07-07T22:44:04.000Z","dependencies_parsed_at":"2024-07-07T23:51:29.886Z","dependency_job_id":null,"html_url":"https://github.com/charonn0/RB-bzip2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/charonn0/RB-bzip2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-bzip2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-bzip2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-bzip2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-bzip2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charonn0","download_url":"https://codeload.github.com/charonn0/RB-bzip2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charonn0%2FRB-bzip2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28999551,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T23:10:54.274Z","status":"ssl_error","status_checked_at":"2026-02-01T23:10:47.298Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","realbasic","xojo"],"created_at":"2024-10-14T02:05:16.227Z","updated_at":"2026-02-02T01:31:19.848Z","avatar_url":"https://github.com/charonn0.png","language":"REALbasic","funding_links":["https://github.com/sponsors/charonn0"],"categories":[],"sub_categories":[],"readme":"## Introduction\n[BZip2](https://en.wikipedia.org/wiki/BZip2) is a commonly used general purpose data compression algorithm. \n\n**RB-BZip2** is a BZip2 [binding](http://en.wikipedia.org/wiki/Language_binding) for Realbasic and Xojo projects.\n\n## Hilights\n* Read and write compressed file or memory streams using a simple [BinaryStream work-alike](https://github.com/charonn0/RB-bzip2/wiki/BZip2.BZ2Stream).\n\n## Become a sponsor\nIf you use this code in a commercial project, or just want to show your appreciation, please consider sponsoring me through GitHub. https://github.com/sponsors/charonn0\n\n## Getting started\nThis project provides several different ways to use BZip2. \n\n### Utility methods\nThe easiest way to use this project are the utility methods in the BZip2 module: \n\n* [**`Compress`**](https://github.com/charonn0/RB-bzip2/wiki/BZip2.Compress)\n* [**`Decompress`**](https://github.com/charonn0/RB-bzip2/wiki/BZip2.Decompress)\n\nThese methods are overloaded with several useful variations on input and output parameters. All variations follow either this signature:\n\n```realbasic\n function(source, destination, options[...]) As Boolean\n```\nor this signature:\n```realbasic\n function(source, options[...]) As MemoryBlock\n```\n\nwhere `source` is a `MemoryBlock`, `FolderItem`, or an object which implements the `Readable` interface; and `destination` (when provided) is a `FolderItem` or an object which implements the `Writeable` interface. Methods which do not have a `Destination` parameter return output as a `MemoryBlock` instead. Refer to the [examples](https://github.com/charonn0/RB-bzip2/wiki#more-examples) below for demonstrations of some of these functions.\n\n### BZ2Stream class\nThe second way to use BZip2 is with the [`BZ2Stream`](https://github.com/charonn0/RB-bzip2/wiki/BZip2.BZ2Stream) class. The `BZ2Stream` is a `BinaryStream` work-alike, and implements both the `Readable` and `Writeable` interfaces. Anything [written](https://github.com/charonn0/RB-bzip2/wiki/BZip2.BZ2Stream.Write) to a `BZ2Stream` is compressed and emitted to the output stream (another `Writeable`); [reading](https://github.com/charonn0/RB-bzip2/wiki/BZip2.BZ2Stream.Read) from a `BZ2Stream` decompresses data from the input stream (another `Readable`).\n\nInstances of `BZ2Stream` can be created from MemoryBlocks, FolderItems, and objects that implement the `Readable` and/or `Writeable` interfaces. For example, creating an in-memory compression stream from a zero-length MemoryBlock and writing a string to it:\n\n```realbasic\n  Dim output As New MemoryBlock(0)\n  Dim z As New BZip2.BZ2Stream(output) ' zero-length creates a compressor\n  z.Write(\"Hello, world!\")\n  z.Close\n```\nThe string will be processed through the compressor and written to the `output` MemoryBlock. To create a decompressor pass a MemoryBlock whose size is \u003e 0 (continuing from above):\n\n```realbasic\n  z = New BZip2.BZ2Stream(output) ' output contains the compressed string\n  MsgBox(z.Read(64)) ' read the decompressed string\n```\n\n### Compressor and Decompressor classes\nThe third and final way to use this project is through the [Compressor](https://github.com/charonn0/RB-bzip2/wiki/BZip2.Compressor) and [Decompressor](https://github.com/charonn0/RB-bzip2/wiki/BZip2.Decompressor) classes. These classes provide a low-level wrapper to the BZip2 API. All compression and decompression done using the `BZ2Stream` class or the utility methods is ultimately carried out by an instance of `Compressor` and `Decompressor`, respectively.\n\n\n## More examples\nThis example compresses and decompresses a MemoryBlock:\n```realbasic\n  Dim data As MemoryBlock = \"Potentially very large MemoryBlock goes here!\"\n  Dim comp As MemoryBlock = BZip2.Compress(data)\n  Dim dcmp As MemoryBlock = BZip2.Decompress(comp)\n```\n\nThis example bzips a file:\n\n```realbasic\n  Dim src As FolderItem = GetOpenFolderItem(\"\") ' a file to be bzipped\n  Dim dst As FolderItem = src.Parent.Child(src.Name + \".bz2\")\n  If BZip2.Compress(src, dst) Then \n    MsgBox(\"Compression succeeded!\")\n  Else\n    MsgBox(\"Compression failed!\")\n  End If\n```\n\nThis example opens an existing bzip2 file and decompresses it into a `MemoryBlock`:\n```realbasic\n  Dim f As FolderItem = GetOpenFolderItem(\"\") ' the bzip file to open\n  Dim data As MemoryBlock = BZip2.Decompress(f)\n  If data \u003c\u003e Nil Then\n    MsgBox(\"Decompression succeeded!\")\n  Else\n    MsgBox(\"Decompression failed!\")\n  End If\n```\n\n## How to incorporate bzip2 into your Realbasic/Xojo project\n### Import the `BZip2` module\n1. Download the RB-bzip2 project either in [ZIP archive format](https://github.com/charonn0/RB-bzip2/archive/master.zip) or by cloning the repository with your Git client.\n2. Open the RB-bzip2 project in REALstudio or Xojo. Open your project in a separate window.\n3. Copy the `BZip2` module into your project and save.\n\n### Ensure the bzip2 shared library is installed\nbzip2 is installed by default on many Unix-like operating systems, however it may need to be installed separately.\n\nWindows does not have it installed by default, you will need to ship the DLL with your application. You can use pre-built DLL available [here](http://gnuwin32.sourceforge.net/packages/bzip2.htm) (Win32x86), or you can build them yourself from [source](ftp://sources.redhat.com/pub/bzip2/v102/bzip2-1.0.2.tar.gz). \n\nRB-bzip2 will raise a PlatformNotSupportedException when used if all required DLLs/SOs/DyLibs are not available at runtime. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharonn0%2Frb-bzip2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharonn0%2Frb-bzip2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharonn0%2Frb-bzip2/lists"}