txtar

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Evolution of golang.org/x/tools/txtar, handling encoding for binary data

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Format

func Format(a *Archive) []byte

Format returns the serialized form of an Archive. It is assumed that the Archive data structure is well-formed: a.Comment and all a.File[i].Data contain no file marker lines, and all a.File[i].Name is non-empty.

Types

type Archive

type Archive struct {
	Comment []byte
	Files   []File
}

An Archive is a collection of files.

func Parse

func Parse(data []byte) *Archive

Parse parses the serialized form of an Archive. The returned Archive holds slices of data.

func ParseFile

func ParseFile(file string) (*Archive, error)

ParseFile parses the named file as an archive.

func (*Archive) Get

func (a *Archive) Get(name string) []byte

Get return file at name This panics if the file does not exist, and should only be used in tests

type File

type File struct {
	Name string // name of file ("foo/bar.txt")
	Data []byte // text content of file
}

A File is a single file in an archive.

Jump to

Keyboard shortcuts

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