From 40401087e443ef88aa394a799716691856d15b39 Mon Sep 17 00:00:00 2001 From: JMARyA Date: Sat, 2 Mar 2024 15:47:47 +0100 Subject: [PATCH] add zstd --- technology/applications/cli/ripgrep-all.md | 20 ++++---- technology/files/Zstd Compression.md | 58 ++++++++++++++++++++++ 2 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 technology/files/Zstd Compression.md diff --git a/technology/applications/cli/ripgrep-all.md b/technology/applications/cli/ripgrep-all.md index 5ce9c6c..097225e 100644 --- a/technology/applications/cli/ripgrep-all.md +++ b/technology/applications/cli/ripgrep-all.md @@ -12,23 +12,23 @@ rga is a line-oriented search tool that allows you to look for a [regex](../../t ## FLAGS: -| Option | Description | -| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Option | Description | +| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --rga-accurate | Use more accurate but slower matching by [mime](../../files/MIME.md) type
By default, rga will match files using file extensions. Some programs,
such as sqlite3, don't care about the file extension at all, so users
sometimes use any or no extension at all. With this flag, rga will try
to detect the [mime](../../files/MIME.md) type of input files using the magic bytes (similar
to the [`file`](system/file.md) utility), and use that to choose the adapter. Detection is
only done on the first 8KiB of the file, since we can't always seek on the input (in archives). | -| --rga-no-cache | Disable caching of results
By default, rga caches the extracted text, if it is small enough, to a
database in ${XDG_CACHE_DIR-~/.cache}/ripgrep-all on Linux,
~Library/Caches/ripgrep-all on macOS, or C:\\Users\\username\\AppData\\Local\\ripgrep-all on Windows. This way,
repeated searches on the same set of files will be much faster. If you
pass this flag, all caching will be disabled. | -| --rga-list-adapters | List all known adapters | -| --rga-print-config-schema | Print the [JSON Schema](../../tools/JSON%20Schema.md) of the configuration file | -| --rg-help | Show help for [ripgrep](ripgrep.md) itself | -| --rg-version | Show version of [ripgrep](ripgrep.md) itself | -| -V, --version | Prints version information | +| --rga-no-cache | Disable caching of results
By default, rga caches the extracted text, if it is small enough, to a
database in ${XDG_CACHE_DIR-~/.cache}/ripgrep-all on Linux,
~Library/Caches/ripgrep-all on macOS, or C:\\Users\\username\\AppData\\Local\\ripgrep-all on Windows. This way,
repeated searches on the same set of files will be much faster. If you
pass this flag, all caching will be disabled. | +| --rga-list-adapters | List all known adapters | +| --rga-print-config-schema | Print the [JSON Schema](../../tools/JSON%20Schema.md) of the configuration file | +| --rg-help | Show help for [ripgrep](ripgrep.md) itself | +| --rg-version | Show version of [ripgrep](ripgrep.md) itself | +| -V, --version | Prints version information | ## OPTIONS: | Option | Description | | ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | --rga-adapters=\... | Change which adapters to use and in which priority order (descending)
"foo,bar" means use only adapters foo and bar. "-bar,baz" means use all default adapters except for bar and baz. "+bar,baz" means use all default adapters and also bar and baz. | -| --rga-cache-compression-level=\ | ZSTD compression level to apply to adapter outputs before storing in
cache db
Ranges from 1 - 22 \[default: 12\] | -| --rga-config-file=\ | | +| --rga-cache-compression-level=\ | [ZSTD compression](../../files/Zstd%20Compression.md) level to apply to adapter outputs before storing in
cache db
Ranges from 1 - 22 \[default: 12\] | +| --rga-config-file=\ | | | --rga-max-archive-recursion=\ | Maximum nestedness of archives to recurse into \[default: 5\] | | --rga-cache-max-blob-len=\ | Max compressed size to cache
Longest byte length (after compression) to store in cache. Longer
adapter outputs will not be cached and recomputed every time.
Allowed suffixes on command line: k M G \[default: 2000000\] | | --rga-cache-path=\ | Path to store cache db \[default: /home/user/.cache/ripgrep-all\] | diff --git a/technology/files/Zstd Compression.md b/technology/files/Zstd Compression.md new file mode 100644 index 0000000..b36aa79 --- /dev/null +++ b/technology/files/Zstd Compression.md @@ -0,0 +1,58 @@ +--- +obj: concept +aliases: ["zstd"] +repo: https://github.com/facebook/zstd +wiki: https://en.wikipedia.org/wiki/Zstd +--- + +# Zstd +Zstandard, also known as zstd, is a fast lossless compression algorithm. It offers both excellent compression ratios and high-speed compression and decompression. Zstandard is designed to be highly versatile, suitable for a wide range of applications from data compression to streaming and archiving. + +## Features +### High Compression Ratios +Zstandard achieves competitive compression ratios compared to other compression algorithms like gzip, lz4, and [xz](XZ%20Compression.md). It offers the flexibility to adjust compression levels according to specific requirements, balancing between speed and compression efficiency. + +### High-Speed Compression and Decompression +One of the key strengths of Zstandard is its impressive speed. It is optimized for both compression and decompression, making it suitable for scenarios where fast processing is essential, such as real-time data streaming and high-performance computing. + +### Streaming Compression +Zstandard supports streaming compression and decompression, allowing data to be compressed or decompressed in chunks without needing to hold the entire dataset in memory. This feature is particularly useful for applications dealing with large datasets or continuous streams of data. + +### Dictionary Compression +Zstandard includes support for dictionary compression, where a predefined dictionary can be used to improve compression ratios for specific types of data. This feature is beneficial for scenarios where the data has a predictable structure or repeating patterns. + +### Multi-Threading Support +Zstandard utilizes multi-threading to leverage the processing power of modern multi-core CPUs, speeding up compression and decompression tasks even further. This feature enhances performance, especially on systems with multiple CPU cores. + +## Usage +Usage: `zstd [OPTIONS...] [INPUT... | -] [-o OUTPUT]` + +### Options +| Option | Description | +| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `-o OUTPUT` | Write output to a single file, OUTPUT. | +| `-k, --keep` | Preserve INPUT file(s). \[Default] | +| `--rm` | Remove INPUT file(s) after successful (de)compression. | +| `-#` | Desired compression level, where `#` is a number between 1 and 19; lower numbers provide faster compression, higher numbers yield better compression ratios. \[Default: 3] | +| `-d, --decompress` | Perform decompression. | +| `-D DICT` | Use DICT as the dictionary for compression or decompression. | +| `-f, --force` | Disable input and output checks. Allows overwriting existing files, receiving input from the console, printing output to STDOUT, and operating on links, block devices, etc. | +| `-c, --stdout` | Write to STDOUT (even if it is a console) and keep the INPUT file(s). | +| `-v, --verbose` | Enable verbose output; pass multiple times to increase verbosity. | +| `-q, --quiet` | Suppress warnings; pass twice to suppress errors. | +| `--[no-]progress` | Forcibly show/hide the progress counter. NOTE: Any (de)compressed output to terminal will mix with progress counter text. | +| `-r` | Operate recursively on directories. | +| `--filelist LIST` | Read a list of files to operate on from LIST. | +| `--output-dir-flat DIR` | Store processed files in DIR. | +| `--output-dir-mirror DIR` | Store processed files in DIR, respecting original directory structure. | +| `--[no-]asyncio` | Use asynchronous IO. \[Default: Enabled] | +| `--[no-]check` | Add XXH64 integrity checksums during compression. \[Default: Add, Validate] If `-d` is present, ignore/validate checksums during decompression. | +| `--ultra` | Enable levels beyond 19, up to 22; requires more memory. | +| `--fast[=#]` | Use to very fast compression levels. \[Default: 1] | +| `--long[=#]` | Enable long distance matching with window log `#`. \[Default: 27] | +| `-T#` | Spawn # compression threads. \[Default: 1; pass 0 for core count.] | +| `-l` | Print information about Zstandard-compressed files. | +| `--test` | Test compressed file integrity. | +| `-M#` | Set the memory usage limit to # megabytes. | +| `--[no-]sparse` | Enable sparse mode. \[Default: Enabled for files, disabled for STDOUT.] | +| `--[no-]pass-through` | Pass through uncompressed files as-is. \[Default: Disabled] |