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

Overview

go-tarfs

Go Reference GitHub release (latest SemVer) GitHub Workflow Status 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 (
    "os"

    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 := tarfs.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.

Show your support

Give a ⭐️ if this project helped you!

Author

👤 Nicolas Lepage

Contributors

All Contributors

Thanks goes to these wonderful people (emoji key):


Jonas Plum

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

📝 License

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

Issues
  • Add fstest.TestFS

    Add fstest.TestFS

    Nice package, thanks!

    Go offers a function to test fs.FS implementations: https://tip.golang.org/pkg/testing/fstest/#TestFS. I added a test for this and fixed the revealed issues.

    Sorry for not adding an emoji to the commit message 🙈

    opened by cugu 3
  • Infinite loop when walking through archive containing . (dot) entry

    Infinite loop when walking through archive containing . (dot) entry

    STEPS

    1. Create an archive:

      mkdir empty_dir
      tar -cf fs_test_infinite_loop.tar -C empty_dir .
      
    2. Walk the archive using fs.WalkDir function.

    EXPECTED: The walk function is called once. OBSERVED: The walk function is in an infinite loop.

    bug 
    opened by adyatlov 2
  • Feature request: Support tar files missing directory entries

    Feature request: Support tar files missing directory entries

    Some tar files may have file entries with a path inside of a directory (eg dir1/file11), but miss corresponding directory entries (eg have no entry for dir1).

    ping @mihaibuzgau @viovanov I saw both of you had forks to support this, I just released a v1.1.0 which supports this.

    enhancement 
    opened by nlepage 1
Releases(v1.1.0)
Owner
Nicolas Lepage
Developer @ Zenika Nantes
Nicolas Lepage
Vaala archive is a tar archive tool & library optimized for lots of small files.

?? Vaar ?? Vaala archive is a tar archive tool & library optimized for lots of small files. Written in Golang, vaar performs operations in parallel &

Qing Moy 13 Jul 6, 2022
Tarserv serves streaming tar files from filesystem snapshots.

tarserv A collection of tools that allow serving large datasets from local filesystem snapshots. It is meant for serving big amounts of data to shell

Aurora 1 Jan 11, 2022
s3fs provides a S3 implementation for Go1.16 filesystem interface.

S3 FileSystem (fs.FS) implementation.Since S3 is a flat structure, s3fs simulates directories by using prefixes and "/" delim. ModTime on directories is always zero value.

Jacek Szwec 132 Jun 29, 2022
Read csv file from go using tags

go-csv-tag Read csv file from Go using tags The project is in maintenance mode. It is kept compatible with changes in the Go ecosystem but no new feat

Louis 94 Apr 9, 2022
A FileSystem Abstraction System for Go

A FileSystem Abstraction System for Go Overview Afero is a filesystem framework providing a simple, uniform and universal API interacting with any fil

Steve Francia 4.5k Jun 27, 2022
Read data from rss, convert in pdf and send to kindle. Amazon automatically convert them in azw3.

Kindle-RSS-PDF-AZW3 The Kindle RSS PDF AZW3 is a personal project. The Kindle RSS PDF AZW3 is a personal project. I received a Kindle for Christmas, a

Elia 0 Jan 10, 2022
go-fastdfs 是一个简单的分布式文件系统(私有云存储),具有无中心、高性能,高可靠,免维护等优点,支持断点续传,分块上传,小文件合并,自动同步,自动修复。Go-fastdfs is a simple distributed file system (private cloud storage), with no center, high performance, high reliability, maintenance free and other advantages, support breakpoint continuation, block upload, small file merge, automatic synchronization, automatic repair.(similar fastdfs).

中文 English 愿景:为用户提供最简单、可靠、高效的分布式文件系统。 go-fastdfs是一个基于http协议的分布式文件系统,它基于大道至简的设计理念,一切从简设计,使得它的运维及扩展变得更加简单,它具有高性能、高可靠、无中心、免维护等优点。 大家担心的是这么简单的文件系统,靠不靠谱,可不

小张 3.2k Jun 30, 2022
QueryCSV enables you to load CSV files and manipulate them using SQL queries then after you finish you can export the new values to a CSV file

QueryCSV enable you to load CSV files and manipulate them using SQL queries then after you finish you can export the new values to CSV file

Mohamed Shapan 100 Dec 22, 2021
File Processor in Concurrency Pattern using Golang goroutine.

File Processor in Concurrency Pattern Implement a file processor solution in concurrency pattern using Golang goroutine. Get Started Run docker-compos

null 1 Oct 17, 2021
Abstract File Storage

afs - abstract file storage Please refer to CHANGELOG.md if you encounter breaking changes. Motivation Introduction Usage Matchers Content modifiers S

Viant, Inc 188 Jul 3, 2022
a tool for handling file uploads simple

baraka a tool for handling file uploads for http servers makes it easier to make operations with files from the http request. Contents Install Simple

Enes Furkan Olcay 43 Jun 4, 2022
Bigfile -- a file transfer system that supports http, rpc and ftp protocol https://bigfile.site

Bigfile ———— a file transfer system that supports http, rpc and ftp protocol 简体中文 ∙ English Bigfile is a file transfer system, supports http, ftp and

null 227 Jun 30, 2022
Go file operations library chasing GNU APIs.

flop flop aims to make copying files easier in Go, and is modeled after GNU cp. Most administrators and engineers interact with GNU utilities every da

The Home Depot 31 Feb 10, 2022
File system event notification library on steroids.

notify Filesystem event notification library on steroids. (under active development) Documentation godoc.org/github.com/rjeczalik/notify Installation

Rafal Jeczalik 743 Jun 12, 2022
Pluggable, extensible virtual file system for Go

vfs Package vfs provides a pluggable, extensible, and opinionated set of file system functionality for Go across a number of file system types such as

C2FO 174 Jun 17, 2022
An epoll(7)-based file-descriptor multiplexer.

poller Package poller is a file-descriptor multiplexer. Download: go get github.com/npat-efault/poller Package poller is a file-descriptor multiplexer

Nick Patavalis 105 Apr 5, 2022
Goful is a CUI file manager written in Go.

Goful Goful is a CUI file manager written in Go. Works on cross-platform such as gnome-terminal and cmd.exe. Displays multiple windows and workspaces.

anmitsu 280 Jun 28, 2022
Open Source Continuous File Synchronization

Goals Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers. We strive to fulfill the goals belo

The Syncthing Project 45.5k Jul 6, 2022
Cross-platform file system notifications for Go.

File system notifications for Go fsnotify utilizes golang.org/x/sys rather than syscall from the standard library. Ensure you have the latest version

fsnotify 7k Jul 2, 2022