extract

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

README

Golang Extract

A Golang wrapper to use libarchive, a multi-format archive and compression library, for extraction purposes.

Installation

To install libarchive, build instructions can be found at https://github.com/libarchive/libarchive/wiki/BuildInstructions. If you are using ubuntu pre-requisites can be installed with the build-essential meta-package apt-get install build-essential.

License

The project is provided under the Apache 2.0 license. A copy of the license text can be found in the LICENSE.txt file located in the project’s top-level directory. Because this project is built on other open source components, different files may be under different licenses. As a rule of thumb, each source file should include a license notice that designates the licensing terms for that respective file (unless the file was autogenerated).

All product names, logos, and brands are property of their respective owners. All company, product and service names used in this software are for identification purposes only.

Disclaimer of Warranty / No Support: Wind River does not provide support and maintenance services for this software, under Wind River’s standard Software Support and Maintenance Agreement or otherwise. Unless required by applicable law, Wind River provides the software (and each contributor provides its contribution) on an “AS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, either express or implied, including, without limitation, any warranties of TITLE, NONINFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the software and assume any risks associated with your exercise of permissions under the license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArchiveExtensions []string = []string{".ar", ".arj", ".cpio", ".dump", ".jar", ".7z", ".zip", ".pack", ".pack2000", ".tar", ".snz", ".z", ".tgz", ".rpm", ".gem", ".deb", ".whl", ".apk"}
View Source
var CompressionExtensions []string = []string{".bz2", ".gz", ".lzma", ".xz"}
View Source
var KnownExtensions []string

Extensions known to be archives or compressed files

View Source
var PlaintextExtensions []string = []string{".js", ".json", ".txt"}

PlaintextExtensions that if compressed, should be only decompressed, and not passed to the general extractor

Functions

func IsExtractable

func IsExtractable(file string) float64

func RecognizeExtension

func RecognizeExtension(file string) bool

func SplitExt

func SplitExt(s string) (string, string, string)

filepath -> file name, full extension (including .tar), extension

Types

type Extract

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

func New

func New(source, filename string) (*Extract, error)

New creates a new extractor for the given source and file name If file name is empty, it is calculated from the source path

func NewAt

func NewAt(source, filename, target string) (*Extract, error)

NewAt creates a new extractor for the given source and file name, set-up to extract to the given target If file name is empty, it is calculated from the source path

func (*Extract) Enclose

func (e *Extract) Enclose() error

func (Extract) Extract

func (e Extract) Extract() (string, error)

func (Extract) IsEnclosed

func (e Extract) IsEnclosed() bool

func (*Extract) SetPlaintextExtensions

func (e *Extract) SetPlaintextExtensions(extensions []string) *Extract

func (Extract) Source

func (e Extract) Source() string

func (Extract) String

func (e Extract) String() string

func (Extract) Target

func (e Extract) Target() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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