npck

package module
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

README

PkgGoDev GoReportCard Code Climate Maintainability Codebeat badge
Coverage Status GitHub Actions CI Status GitHub Actions CodeQL Status

Supported formatsInstallationUsage exampleCI StatusLicense


npck is a Go package for unpacking various types of archives.

Supported formats

  • tar (.tar)
  • Gzip (.gz, .tgz, .tar.gz)
  • bzip2 (.bz2, .tbz2, .tar.bz2)
  • xz (.xz, .txz, .tar.xz)
  • Zstandart (.zst, .tzst, .tar.zst)
  • LZ4 (.lz4, .tlz4, .tar.lz4)
  • ZIP (.zip)

Installation

Make sure you have a working Go 1.19+ workspace (instructions), then:

go get -u github.com/essentialkaos/npck

Usage example

package main

import (
  "fmt"
  "github.com/essentialkaos/npck"
)

func main() {
  file := "file.tar.gz"
  err := npck.Unpack(file, "/home/john")

  if err != nil {
    fmt.Printf("Error: Can't unpack %s: %v\n", file, err)
    return
  }

  fmt.Printf("File %s successfully unpacked!\n", file)
}

CI Status

Branch Status
master CI
develop CI

License

Apache License, Version 2.0

Documentation

Overview

Package npck provides methods for unpacking various types of archives

Index

Examples

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedFormat = fmt.Errorf("Unknown or unsupported archive type")

Functions

func Unpack

func Unpack(file, dir string) error

Unpack unpacks given file

Example
file := "file.tzg"
err := Unpack(file, "/home/bob/data")

if err != nil {
	fmt.Printf("Error: Can't unpack %s: %v\n", file, err)
	return
}

fmt.Printf("File %s successfully unpacked!\n", file)
Output:

Types

This section is empty.

Directories

Path Synopsis
Package bz2 provides methods for unpacking files with BZip2 compression
Package bz2 provides methods for unpacking files with BZip2 compression
Package gz provides methods for unpacking files with GZip compression
Package gz provides methods for unpacking files with GZip compression
Package lz4 provides methods for unpacking files with LZ4 compression
Package lz4 provides methods for unpacking files with LZ4 compression
Package tar provides method for unpacking tar files
Package tar provides method for unpacking tar files
Package tbz2 provides methods for unpacking tar.bz2 files
Package tbz2 provides methods for unpacking tar.bz2 files
Package tgz provides methods for unpacking tar.gz files
Package tgz provides methods for unpacking tar.gz files
Package tlz4 provides methods for unpacking tar.lz4 files
Package tlz4 provides methods for unpacking tar.lz4 files
Package txz provides methods for unpacking tar.xz files
Package txz provides methods for unpacking tar.xz files
Package tzst provides methods for unpacking tar.zst files
Package tzst provides methods for unpacking tar.zst files
Package utils provides auxiliary methods for working with archives
Package utils provides auxiliary methods for working with archives
Package xz provides methods for unpacking files with XZ compression
Package xz provides methods for unpacking files with XZ compression
Package zip provides methods for unpacking files with ZIP compression
Package zip provides methods for unpacking files with ZIP compression
Package zst provides methods for unpacking files with Zstandart compression
Package zst provides methods for unpacking files with Zstandart compression

Jump to

Keyboard shortcuts

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