tarinator

package module
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2018 License: MIT Imports: 7 Imported by: 9

README

Tarinator-go

Genaral

Tarinator-go a Golang package that simplifies creating tar files and compressing/decompressing them using gzip.

Here is an example for using Tarinator-go (including a tutorial for building it):

https://github.com/verybluebot/cli_tarinator_example

Usage

At this point it can create .tar and tar.gz files from unlimited number of files and directories.

Creat Tar file:

creating .tar file from a list of files and/or directories:

// create an []string of paths to your files and directories

import(
    "github.com/verybluebot/tarinator-go"
)

paths := []string{
    "someFile.txt",
    "someOtherFile.json",
    "someDir/",
    "some/path/to/dir/",
}

err := tarinator.Tarinate(paths, "your_tar_file.tar")
if err != nil {
    // handle error
}

For creating .tar.gz file use .tar.gz to the file name aka your_tar_file.tar.gz.

Extarcing a tar file

For extarcting the tar file just give input the file path and the destenetion to extract in the example below the tar file is in /home/someuser/some_tar.tar and the destenation is /tmp/things/.

import(
    "github.com/verybluebot/tarinator-go"
)

err := tarinator.UnTarinate("/home/someuser/some_tar.tar", "/tmp/things/")
if err != nil {
    // handle error
}

For extracting .tar.gz files just specify a .tar.gz file name and Tarinator-go will recognize it.

Thanks to

Svett Ralchev for this blog post which helped in creation of Tarinator-go

Licence

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Tarinate

func Tarinate(paths []string, tarPath string) error

func UnTarinate

func UnTarinate(extractPath, sourcefile string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL