Categorygithub.com/mcuadros/raa
repositorypackage
1.2.0
Repository: https://github.com/mcuadros/raa.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

raa - Random Access Archive

Build Status Coverage Status GoDoc GitHub release

raa is a file container, similar to tar or zip, focused on allowing constant-time random file access with linear memory consumption increase.

The library implements a very similar API to the go os package, allowing full control over and low level acces to the contained files. raa is based on boltdb, a low-level key/value database for Go.

Installation

The recommended way to install raa

go get -u github.com/mcuadros/go-raa/...

Example

Import the package:

import "github.com/mcuadros/go-raa"

Create a new archive file respredented by a Archive:

a, err = raa.CreateArchive("example.raa")
if err != nil {
    panic(err)
}

Add a new file to your new Archive:

f, _ := a.Create("/hello.txt")
defer f.Close()
f.WriteString("Hello World!")

And now you can read the file contained on the Archive:

f, _ := a.Open("/hello.txt")
defer f.Close()
content, _ := ioutil.ReadAll(f)
fmt.Println(string(content))
//Output: Hello World!

Command-line interface

raa cli interface, is a convinient command that helps you to creates and manipulates raa files.

Output from: ./raa --help:

Usage:
  raa [OPTIONS] <command>

Help Options:
  -h, --help  Show this help message

Available commands:
  list    List the items contained on a file.
  pack    Create a new archive containing the specified items.
  stats   Display some stats about the file.
  unpack  Extract to disk from the archive.

License

MIT, see LICENSE