Project

hrx

0.01
No commit activity in last 3 years
No release in over 3 years
A parser and serializer for the HRX human-readable archive format.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.0.13
 Project Readme

HRX (Human Readable Archive)

This gem is a parser and serializer for the HRX format.

# Load an archive from a path on disk. You can also parse it directly from a
# string using HRX::Archive.parse, or create an empty archive using
# HRX::Archive.new.
archive = HRX::Archive.load("path/to/archive.hrx")

# You can read files directly from an archive as though it were a filesystem.
puts archive.read("dir/file.txt")

# You can also write to files. Writing to a file implicitly creates any
# directories above it. You can also overwrite an existing file.
archive.write("dir/new.txt", "New file contents!\n")

# You can access HRX::File or HRX::Directory objects directly using
# HRX::Archive#[]. Unlike HRX::Archive#read(), this will just return nil if the
# entry isn't found.
archive["dir/file.txt"] # => HRX::File

# You can add files to the end of the archive using HRX::Archive#<< or
# HRX::Archive#add. If you pass `before:` or `after:`, you can control where in
# the archive they're added.
archive << HRX::File.new("dir/newer.txt", "Newer file contents!\n")

# Write the file back to disk. You can also use HRX::Archive#to_hrx to serialize
# the archive to a string.
archive.write!("path/to/archive.hrx")

Executable

This gem also comes with an hrx command-line executable. Use hrx help to learn about what it can do!

This is not an officially supported Google product.