Skip to content

nlepage/go-tarfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-tarfs

Go Reference License Unlicense

Read a tar file contents using go1.16 io/fs abstraction

Usage

⚠️ go-tarfs needs go>=1.16

Install:

go get github.com/nlepage/go-tarfs

Use:

package main

import (
    tarfs "github.com/nlepage/go-tarfs"
)

func main() {
    tf, err := os.Open("path/to/archive.tar")
	if err != nil {
		panic(err)
	}
	defer tf.Close()

	tfs, err := New(tf)
	if err != nil {
		panic(err)
	}

	f, err := tfs.Open("path/to/some/file")
	if err != nil {
		panic(err)
	}
    // defer f.Close() isn't necessary, it is a noop
    
    // use f...
}

More information at pkg.go.dev/github.com/nlepage/go-tarfs

Caveats

For now, no effort is done to support symbolic links.

Author

πŸ‘€ Nicolas Lepage

🀝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

This project is unlicensed, it is free and unencumbered software released into the public domain.