Project

mspack_rb

0.0
No commit activity in last 3 years
No release in over 3 years
A ruby gem wrapper for libmspack
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
>= 0
~> 10.0
~> 3.0
 Project Readme

MspackRb

A simple Ruby native extension gem wrapper for libmspack

Requires libmspack to be installed, and currently, only CHM extraction has been implemented.

The gem is available over at https://rubygems.org/gems/mspack_rb.

Usage:

require 'mspack'

# Extract all files to disk
dcom = Mspack::ChmDecompressor.new
header = dcom.open('path/to/a/chm/file')
header.each_file { |file| dcom.extract(file, '/some/folder') }
dcom.close(header)

# Extract a specific file by name
fast_open_header = dcom.fast_open('path/to/a/chm/file')
file = dcom.fast_find(fast_open_header, '/index.html')
dcom.extract(file, '~/some/folder') unless file.nil?

# Get extracted file bytes as an array
dcom.extract(file) { |data_chunk| do_something_with_bin_string(data_chunk) }

# check last error
p 'w00t' if dcom.last_error == :ok