package asm

import "github.com/vbatts/tar-split/tar/asm"

Package asm provides the API for streaming assembly and disassembly of tar archives.

Using the `github.com/vbatts/tar-split/tar/storage` for Packing/Unpacking the metadata for a stream, as well as an implementation of Getting/Putting the file entries' payload.

Index

Functions

func IterateHeaders

func IterateHeaders(unpacker storage.Unpacker, handler func(hdr *tar.Header) error) error

IterateHeaders calls handler for each tar header provided by Unpacker

func NewInputTarStream

func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io.Reader, error)

NewInputTarStream wraps the Reader stream of a tar archive and provides a Reader stream of the same.

In the middle it will pack the segments and file metadata to storage.Packer `p`.

The the storage.FilePutter is where payload of files in the stream are stashed. If this stashing is not needed, you can provide a nil storage.FilePutter. Since the checksumming is still needed, then a default of NewDiscardFilePutter will be used internally

func NewOutputTarStream

func NewOutputTarStream(fg storage.FileGetter, up storage.Unpacker) io.ReadCloser

NewOutputTarStream returns an io.ReadCloser that is an assembled tar archive stream.

It takes a storage.FileGetter, for mapping the file payloads that are to be read in, and a storage.Unpacker, which has access to the rawbytes and file order metadata. With the combination of these two items, a precise assembled Tar archive is possible.

func WriteOutputTarStream

func WriteOutputTarStream(fg storage.FileGetter, up storage.Unpacker, w io.Writer) error

WriteOutputTarStream writes assembled tar archive to a writer.

Source Files

assemble.go disassemble.go doc.go iterate.go

Version
v0.12.1 (latest)
Published
Jan 30, 2025
Platform
linux/amd64
Imports
8 packages
Last checked
3 weeks ago

Tools for package owners.