https://github.com/sclevine/ztgrep
Streaming search inside nested archives
https://github.com/sclevine/ztgrep
archive bz2 go golang grep gz gzip search tar xz zip zstd
Last synced: 2 months ago
JSON representation
Streaming search inside nested archives
- Host: GitHub
- URL: https://github.com/sclevine/ztgrep
- Owner: sclevine
- License: apache-2.0
- Created: 2022-02-07T01:59:50.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-11T23:51:41.000Z (about 3 years ago)
- Last Synced: 2025-02-02T06:11:29.238Z (3 months ago)
- Topics: archive, bz2, go, golang, grep, gz, gzip, search, tar, xz, zip, zstd
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ztgrep
[](https://pkg.go.dev/github.com/sclevine/ztgrep)
[](https://github.com/sclevine/ztgrep/actions/workflows/go.yml)Search inside nested archives.
Useful for locating data lost inside many levels of compressed archives without using additional storage.
Supports the following compression formats for **both archives and files**:
- gzip
- bzip2
- xz (requires [xz-utils](https://tukaani.org/xz/) with `xz` CLI on `$PATH`)
- zstd (requires [zstd](https://github.com/facebook/zstd) with `zstd` CLI on `$PATH`)
- uncompressedAs well as the following archive formats:
- Tar (V7, USTAR, PAX, GNU, STAR)
- [ZIP](https://en.wikipedia.org/wiki/ZIP_(file_format)) (with size limitation)Compressed files and archives must have a recognizable file extension to be searched.
If multiple paths are specified, they are searched in parallel with nondeterministic output order.
However, output order is deterministic for any single path.
Only one path per CPU is searched concurrently.Nested ZIP files must be read into memory to be searched.
By default, ZIP files larger 10 MB are not searched.
The `-z` option may be used to adjust the size limit.```
Usage:
ztgrep [OPTIONS] regexp paths...Search Options:
-b, --skip-body Skip file bodies
-n, --skip-name Skip file names inside of tarballs
-z, --max-zip-size= Maximum zip file size to search in bytes (default: 10 MB)General Options:
-v, --version Return ztgrep versionHelp Options:
-h, --help Show this help message
```### Installation
Binaries for macOS, Linux, and Windows are [attached to each release](https://github.com/sclevine/ztgrep/releases) and available via [Homebrew](https://brew.sh):
```
brew install sclevine/tap/ztgrep
````ztgrep` is also available as a [Docker image](https://hub.docker.com/r/sclevine/ztgrep).
### Go Package
ztgrep may be imported as a Go package.
See [godoc](https://pkg.go.dev/github.com/sclevine/ztgrep) for details.