Categorygithub.com/pschou/go-exploder
modulepackage
0.0.0-20230419140859-ba48eb049148
Repository: https://github.com/pschou/go-exploder.git
Documentation: pkg.go.dev

# README

go-exploder

This is a generalized archive exploder which can take an array of archive formats and expand them for inspection.

Archive formats supported:

  • 7zip
  • bzip2
  • cab
  • cpio
  • debian
  • gzip bgzf apk
  • iso9660
  • lzma
  • rar
  • rpm
  • tar
  • xz
  • zip aar docx epub ipa jar kmz maff msix odp ods odt pk3 pk4 pptx usdz vsdx xlsx xpi
  • zstd

Example

Here is an example of an infinite explosion. To get a finite number of layers extracted, set -1 to a value like 2 or 3.

  fh, err := os.Open("testdata.zip") // Open a file
  if err != nil {
    log.Fatal(err)
  }
  stat, err := fh.Stat() // Stat the file to get the size
  if err != nil {
    log.Fatal(err)
  }

  outputPath := "output/"

  err = exploder.Explode(outputPath, fh, stat.Size(), -1)

After this has processed, a folder named output will be created with layers upon layers of files in them.

Documentation

Documentation and usage can be found at:

https://pkg.go.dev/github.com/pschou/go-exploder

# Functions

Explode the archive by looking at the file MagicBytes and then try that archive reader so as to extract layers of archives all at once.
Similar to the Explode, but provides a custom call back function for each file.

# Variables

No description provided by the author

# Structs

FileReader provides the ability to read the underlying bytes from a file in an archive.