compress

package
v1.45.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

compress

form: https://github.com/artdarek/go-unzip

Wrapper for Zip and 7zip decompression.

Example

package main

import (
	"fmt"

	"github.com/ulib/fsutil/compress"
)

func main() {
	u := compress.NewSevenZip()

	files, err := u.Extract("./data/file.7z", "./data/directory")
	if err != nil {
		panic(err)
	}

	fmt.Printf("extracted files count: %d \n", len(files))
	fmt.Printf("files list: %v \n", files)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTargetType = errors.New("The target directory type is file")

Functions

func ExtractAndWriteFile added in v1.20.0

func ExtractAndWriteFile(destination string, zipFile *zip.File) error

ExtractAndWriteFile extracts a file from a zip archive and writes it to the specified destination path. If the file is a directory, it ensures the directory exists. Otherwise, writes the file content to the destination. Returns an error if path validation fails, if file writing fails, or if creating directories encounters issues.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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