Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A blazing fast concurrent zip archiver and extractor.

License

NotificationsYou must be signed in to change notification settings

ybirader/pzip

Repository files navigation

logo-5

pzip

pzip, short for parallel-zip, is a blazing fast concurrent zip archiver and extractor.

Features

  • Archives files and directories into a valid zip archive, using DEFLATE.
  • Preserves modification times of files.
  • Files are read and compressed concurrently

Installation

Command Line

For command-line usage, we provide two binaries which can be installed separately:

  • pzip- concurrent zip archiving
  • punzip- concurrent zip extraction

To install, run:

macOS

For zip archiving:brew install ybirader/pzip/pzip

For zip extraction:brew install ybirader/pzip/punzip

Debian, Ubuntu, Raspbian

For the latest stable release:

curl -1sLf 'https://dl.cloudsmith.io/public/pzip/stable/setup.deb.sh' | sudo -E bashsudo apt updatesudo apt install pzip
curl -1sLf 'https://dl.cloudsmith.io/public/pzip/stable/setup.deb.sh' | sudo -E bashsudo apt updatesudo apt install punzip

Go

Alternatively, if you have Go installed:

go install github.com/ybirader/pzip

Build from source

To build from source, we require Go 1.21 or newer.

  1. Clone the repository by runninggit clone "https://github.com/ybirader/pzip.git"
  2. Build both pzip and punzip by runningmake build or build separately viacd cmd/pzip && go build andcd cmd/punzip && go build

Usage

Archiving

pzip's API is similar to that of the standard zip utlity found on most *-nix systems.

pzip /path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ... path/to/file_or_directoryN

Alternatively, pzip can be imported as a package

archive,err:=os.Create("archive.zip")iferr!=nil {log.Fatal(err)}archiver,err:=pzip.NewArchiver(archive)iferr!=nil {log.Fatal(err)}deferarchiver.Close()files:= []string{"./hello","./hello.txt","./bye.md" }err=archiver.Archive(context.Background(),files)iferr!=nil {log.Fatal(err)}

The concurrency of the archiver can be configured using the corresponding flag:

pzip --concurrency 2 /path/to/compressed.zip path/to/file_or_directory1 path/to/file_or_directory2 ... path/to/file_or_directoryN

or by passing theArchiverConcurrency option:

archiver,err:=pzip.NewArchiver(archive,ArchiverConcurrency(2))

Extraction

punzip's API is similar to that of the standard unzip utlity found on most *-nix systems.

punzip /path/to/compressed.zip

By default,punzip extracts into the current directory. We can extract to a particular path by:

punzip -d /path/to/output /path/to/compressed.zip

Using the Go package, we have:

outputDirPath:="./output"archivePath:="./archive.zip"extractor,err:=pzip.NewExtractor(outputDirPath)iferr!=nil {log.Fatal(err)}deferextractor.Close()err=extractor.Extract(context.Background(),archivePath)iferr!=nil {log.Fatal(err)}

As with pzip, we can configure the concurrency of the extractor using:

punzip --concurrency 2 /path/to/compressed.zip

Similarly, with the Go package, we pass in theExtractorConcurrency option:

extractor,err:=pzip.NewExtractor(outputDirPath,ExtractorConcurrency(2))

Benchmarks

pzip was benchmarked using Matt Mahoney'ssample directory.

Using the standardzip utlity, we get the following time to archive:

real    14m31.809suser    13m12.833ssys     0m24.193s

Running the same benchmark with pzip, we find that:

real    0m56.851suser    3m32.619ssys     1m25.040s

Contributing

To contribute to pzip, first submit or comment in an issue to discuss your contribution, then open a pull request (PR).

License

pzip is released under theApache 2.0 license.

Acknowledgements

Many thanks to the folks atCloudsmith for graciously providing Debian package hosting. Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.

About

A blazing fast concurrent zip archiver and extractor.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp