All Projects → src-d → Go Siva

src-d / Go Siva

Licence: mit
siva - seekable indexed verifiable archiver

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Go Siva

Tiny7z
tiny7z is a native C# SevenZip 7zip .7z file format archive reader/writer
Stars: ✭ 16 (-82.8%)
Mutual labels:  archive
Mybox
Easy tools of document, image, file, network, location, color, and media.
Stars: ✭ 45 (-51.61%)
Mutual labels:  archive
Archivemounter
Mounts archives like disk images (macOS)
Stars: ✭ 77 (-17.2%)
Mutual labels:  archive
Nyaa
Nyaa.se replacement written in golang
Stars: ✭ 924 (+893.55%)
Mutual labels:  archive
Talks
Доклады с мероприятий #GolangKazan
Stars: ✭ 34 (-63.44%)
Mutual labels:  archive
Node Har Validator
Extremely fast HTTP Archive (HAR) validator using JSON Schema
Stars: ✭ 52 (-44.09%)
Mutual labels:  archive
Onlyfans
Scrape all the media from an OnlyFans account - Updated regularly
Stars: ✭ 731 (+686.02%)
Mutual labels:  archive
Gittar
🎸 Download and/or Extract git repositories (GitHub, GitLab, BitBucket). Cross-platform and Offline-first!
Stars: ✭ 87 (-6.45%)
Mutual labels:  archive
Zipper
🗳A library to create, read and modify ZIP archive files, written in Swift.
Stars: ✭ 38 (-59.14%)
Mutual labels:  archive
Bagit Java
Java library to support the BagIt specification.
Stars: ✭ 65 (-30.11%)
Mutual labels:  archive
Prior Standards
Archive of prior TDWG standards
Stars: ✭ 10 (-89.25%)
Mutual labels:  archive
Singlefilez
Web Extension for Firefox/Chrome/MS Edge and CLI tool to save a faithful copy of an entire web page in a self-extracting HTML/ZIP polyglot file
Stars: ✭ 882 (+848.39%)
Mutual labels:  archive
Uso Archive
Preserving styles from the slow and unmaintained UserStyles.org
Stars: ✭ 53 (-43.01%)
Mutual labels:  archive
Casync
Content-Addressable Data Synchronization Tool
Stars: ✭ 890 (+856.99%)
Mutual labels:  archive
Project Evidence.github.io
Evidence SARS-CoV-2 Emerged From a Biological Laboratory in Wuhan, China
Stars: ✭ 80 (-13.98%)
Mutual labels:  archive
Grav Plugin Archive Plus
The Grav Archive Plus plugin is an enhanced version of the Grav Archives plugin wih more configuration options and the ability to show a blogger like hierarchical archive menu for links grouped by month and/or year.
Stars: ✭ 6 (-93.55%)
Mutual labels:  archive
Symbian Archive
A small website to archive Symbian-related dev tools & doc.
Stars: ✭ 46 (-50.54%)
Mutual labels:  archive
Reminiscence
Self-Hosted Bookmark And Archive Manager
Stars: ✭ 1,303 (+1301.08%)
Mutual labels:  archive
Dareblopy
Data Reading Blocks for Python
Stars: ✭ 82 (-11.83%)
Mutual labels:  archive
Web Archives
A web archives reader
Stars: ✭ 52 (-44.09%)
Mutual labels:  archive

siva format GoDoc Build Status Build status codebeat badge

siva stand for seekable indexed verifiable archiver

siva is archive format very similar to tar or zip, focused on allowing: constant-time random file access, seekable access to the contained files and concatenable archive files

siva

The library implements a very similar API to the go tar package, allowing full control over and low level access to the contained files.

Installation

The recommended way to install siva

go get -u gopkg.in/src-d/go-siva.v1/...

Example

Creating a siva file:

// Create a buffer to write our archive to.
buf := new(bytes.Buffer)

// Create a new siva archive.
w := siva.NewWriter(buf)

// Add some files to the archive.
var files = []struct {
    Name, Body string
}{
    {"readme.txt", "This archive contains some text files."},
    {"gopher.txt", "Gopher names:\nGeorge\nGeoffrey\nGonzo"},
    {"todo.txt", "Get animal handling license."},
}
for _, file := range files {
    hdr := &siva.Header{
        Name:    file.Name,
        Mode:    0600,
        ModTime: time.Now(),
    }
    if err := w.WriteHeader(hdr); err != nil {
        log.Fatalln(err)
    }
    if _, err := w.Write([]byte(file.Body)); err != nil {
        log.Fatalln(err)
    }
}
// Make sure to check the error on Close.
if err := w.Close(); err != nil {
    log.Fatalln(err)
}

Reading from a siva file:

// Open the siva archive for reading.
file := bytes.NewReader(buf.Bytes())
r := siva.NewReader(file)

// Get all the files in the siva file.
i, err := r.Index()
if err != nil {
    log.Fatalln(err)
}

// Iterate through the files in the archive.
for _, e := range i {
    content, err := r.Get(e)
    if err != nil {
        log.Fatalln(err)
    }
    fmt.Printf("Contents of %s:\n", e.Name)
    if _, err := io.Copy(os.Stdout, content); err != nil {
        log.Fatalln(err)
    }
    fmt.Println()
}

Command-line interface

siva cli interface, is a convenient command that helps you to creates and manipulates siva files.

Output from: ./siva --help:

Usage:
  siva [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.
  unpack   Extract to disk from the archive.
  version  Show the version information.

Other comments

  • The Index Signature is specified as a sequence of 3 bytes. Go uses byte as an alias for uint8.
  • File Mode in an Index entry, see issue.
  • This implementation left in the client of the library side the task of check the integrity of the file contents. It just checks for the Index integrity.

License

MIT, see LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].