go-archive-extractor

module
v0.0.0-...-7247d0d Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0

README

Go Report Card License test coverage badge Gitter


arc-extract logo

go-archive-extractor

The archive-extractor is an open-source library for extracting various archive types.

it returns archive headers metadata (name,size,timestamp,sha1 and sha256)

it also supports different types of tar compressions

Installation

go get github.com/chen-keinan/go-archive-extractor

Supported Archives

  • tar
  • zip
  • rpm
  • deb
  • 7zip

Supported Tar Compression

  • bz2
  • gz
  • Z
  • infla
  • xp3
  • xz

Usage

Zip Usage
zip := extractor.New(extractor.Zip)
headers, err = zip.Extract("common.zip");
fmt.Print(headers)
Tar Usage
tar := extractor.New(extractor.Tar)
headers, err = tar.Extract("common.tar");
if err != nil {
   fmt.Print(err.Error())
}
fmt.Print(headers)
Debian Usage
deb := extractor.New(extractor.Deb)
headers, err = deb.Extract("common.deb");
if err != nil {
  fmt.Print(err.Error())
}
fmt.Print(headers)
RPM Usage
rpm := extractor.New(extractor.Rpm)
headers, err = rpm.Extract("common.rpm");
if err != nil {
  fmt.Print(err.Error())
}
fmt.Print(headers)
7z Usagey
sevenZip := extractor.New(extractor.SevenZip)
headers, err = sevenZip.Extract("common.7z");
if err != nil {
  fmt.Print(err.Error())
}
fmt.Print(headers)
package main

import (
	"fmt"
	"github.com/chen-keinan/go-archive-extractor/pkg/extractor"
)

func main() {
	zip := extractor.New(extractor.Zip)
	headers, err := zip.Extract("common.zip")
	if err != nil {
		fmt.Print(err.Error())
	}
	fmt.Print(headers)
}
Archive Header
type ArchiveHeader struct {
Name          string
ModTime       int64
Size          int64
Sha1          string
Sha2          string
PkgMeta       map[string]interface{}
ArchiveReader io.Reader
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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