cpio

package module
v1.0.2-0...-46eca3a Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

README

gocpio is a simple library similar to Go’s tar or zip package for accessing cpio archives. It’s not pretty and only implements the new ASCII format. Maybe I’ll refactor and implement other formats some day.


Version 1.1.0

Documentation

Overview

Package cpio implements access to cpio archives. Implementation of the new ASCII formate (SVR4) defined here: http://people.freebsd.org/~kientzle/libarchive/man/cpio.5.txt

Index

Constants

View Source
const (
	TYPE_SOCK    = 014
	TYPE_SYMLINK = 012
	TYPE_REG     = 010
	TYPE_BLK     = 006
	TYPE_DIR     = 004
	TYPE_CHAR    = 002
	TYPE_FIFO    = 001
)

File types

View Source
const (
	VERSION = "1.1.0"
)

Variables

View Source
var (
	ErrInvalidHeader = errors.New("Did not find valid magic number")
)

Functions

This section is empty.

Types

type Header struct {
	Mode     int64 // permission and mode bits.
	Uid      int   // user id of owner.
	Gid      int   // group id of owner.
	Mtime    int64 // modified time; seconds since epoch.
	Size     int64 // length in bytes.
	Devmajor int64 // major number of character or block device.
	Devminor int64 // minor number of character or block device.
	Type     int64
	Name     string // name of header file entry.
}

Header represents file meta data in an archive. Some fields may not be populated.

func (*Header) IsTrailer

func (h *Header) IsTrailer() bool

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.Reader) *Reader

func (*Reader) Next

func (r *Reader) Next() (*Header, error)

func (*Reader) Read

func (r *Reader) Read(b []byte) (int, error)

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

A writer enables sequential writing of cpio archives. A call to WriteHeader begins a new file. Every call to write afterwards appends to that file, writing at most hdr.Size bytes in total.

func NewWriter

func NewWriter(w io.Writer) *Writer

func (*Writer) Close

func (w *Writer) Close() error

Writes trailer Does not close underlying writer

func (*Writer) Write

func (w *Writer) Write(b []byte) (n int, e error)

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(hdr *Header) error

Jump to

Keyboard shortcuts

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