datapackage

package module
v0.0.0-...-9aea8e3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2016 License: BSD-2-Clause Imports: 14 Imported by: 0

README

InfoModels DataPackage

Circle CICoverage StatusGoDoc

A Go library for handling compressed and optionally encrypted data packages. Documentation available here.

Documentation

Overview

Provides methods for packing directories into compressed and optionally encrypted files as well as unpacking those files into directories.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPackage

type DataPackage struct {
	PackagePath    string // Filename of existing or intended data package.
	KeyPath        string // Path to public key file for encrypting or private key file for decrypting
	PublicKeyEmail string // Email of public key for lookup on remote keyserver (alternative to KeyPath)
	KeyPassPath    string // Path to file containing passphrase for the private key
	// contains filtered or unexported fields
}

DataPackage represents a compressed and optionally encrypted file that may or may not exist on disk, yet.

PackagePath is the full path to the data package file, which may or may not exist, yet. If it is empty, the package will be Packed or Unpacked to STDOUT or from STDIN, respectively.

KeyPath is the full path to a file holding an ASCII-armored GPG key for encryption or decryption (in which case the file must contain both public and private keys).

PublicKeyEmail is the email associated with a public key uploaded to a key server and can be used in place of KeyPath for encryption. If both are given, KeyPath is used instead.

KeyPassPath is the full path to a file holding the password for the key. The password can alternatively be exported to the PACKER_KEYPASS environment variable. The environment variable is preferred if both are given.

func (*DataPackage) Pack

func (d *DataPackage) Pack(dataDirPath string) error

Pack writes the data files at base path into a package.

Example
package main

import (
	"github.com/infomodels/datapackage"
)

func main() {
	d := &datapackage.DataPackage{
		PackagePath:    "/home/user/datapackage.tar.gz.gpg",
		PublicKeyEmail: "testy@test.er",
	}

	d.Pack("/home/user/datadirectory")
}
Output:

func (*DataPackage) Unpack

func (d *DataPackage) Unpack(dataDirPath string) error

Unpack writes files from a package reader to the output directory.

Example
package main

import (
	"github.com/infomodels/datapackage"
)

func main() {
	d := &datapackage.DataPackage{
		PackagePath: "/home/user/datapackage.tar.gz.gpg",
		KeyPath:     "/home/user/keys/public_and_private.asc",
		KeyPassPath: "/home/user/keys/pass.txt",
	}

	d.Unpack("/home/user/datadirectory")
}
Output:

Notes

Bugs

  • The .tar.gz format compressed packages output by DataPackage.Pack cannot be read by standard tar and gzip tools. The authors believe this is due to the underlying library implementations.

Jump to

Keyboard shortcuts

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