goarfs

package module
v0.0.0-...-e3a3ac5 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2023 License: 0BSD Imports: 11 Imported by: 0

README

Go AR FS

Go Reference workflow badge

goarfs logo

goarfs implements the fs.FS interface for AR archive

It implements the following interfaces:

Example usage:

arfs, err := goarfs.FromFile("myfile.ar")
if err != nil {
    panic(err)
}
defer arfs.Close()
data, err := arfs.ReadFile("internalfilename.txt")
if err != nil {
    panic(err)
}
fmt.Printf("Got data %s", data)

Documentation

Overview

Package goarfs is an implementation of the fs.FS interface to make it easy to access data inside AR archives seamlessly as a replacement for direct filesystem access. This is a convenience to make it easy to ship data files around together as as single file, but still access the individual pieces inside.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooShort      = errors.New("AR file too short")
	ErrBadSignature  = errors.New("invalid AR signature")
	ErrBadFileHeader = errors.New("bad AR file header")
)

Functions

This section is empty.

Types

type ARFS

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

func FromFile

func FromFile(filename string) (*ARFS, error)

FromFile loads an AR file from the operating system filesystem and returns the fs.FS compatible interface from it. It will return an error if the AR file is corrupt/invalid.

func FromInterface

func FromInterface(raw io.ReadSeeker) (*ARFS, error)

func (*ARFS) Close

func (a *ARFS) Close() error

func (*ARFS) Glob

func (a *ARFS) Glob(pattern string) ([]string, error)

func (*ARFS) Open

func (a *ARFS) Open(name string) (fs.File, error)

func (*ARFS) ReadDir

func (a *ARFS) ReadDir(name string) ([]fs.DirEntry, error)

func (*ARFS) ReadFile

func (a *ARFS) ReadFile(name string) ([]byte, error)

func (*ARFS) Stat

func (a *ARFS) Stat(name string) (fs.FileInfo, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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