os

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: BSD-3-Clause Imports: 13 Imported by: 1

Documentation

Overview

Package os extend the standard os package to provide additional functionalities.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExtractInputExt = errors.New("unknown extract input extension")
)

Functions

func Extract

func Extract(fileInput, dirOutput string) (err error)

Extract uncompress and/or unarchive file from fileInput into directory defined by dirOutput. This is the high level API that combine standard archive/zip, archive/tar, compress/bzip2, and/or compress/gzip.

The compression and archive format is detected automatically based on the following fileInput extension:

  • .bz2: decompress using compress/bzip2.
  • .gz: decompress using compress/gzip.
  • .tar: unarchive using archive/tar.
  • .zip: unarchive using archive/zip.
  • .tar.bz2: decompress using compress/bzip2 and unarchive using archive/tar.
  • .tar.gz: decompresss using compress/gzip and unarchive using archive/tar.

The output directory, dirOutput, where the decompressed and/or unarchived file stored will be created if not exist. If its empty, it will set to current directory.

On success, the compressed and/or archived file will be removed from the file system.

Types

This section is empty.

Directories

Path Synopsis
Package exec wrap the standar package "os/exec" to simplify calling Run with stdout and stderr.
Package exec wrap the standar package "os/exec" to simplify calling Run with stdout and stderr.

Jump to

Keyboard shortcuts

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