dotnet-compressor
4.0.0
dotnet tool install --global dotnet-compressor --version 4.0.0
dotnet new tool-manifest
dotnet tool install --local dotnet-compressor --version 4.0.0
#tool dotnet:?package=dotnet-compressor&version=4.0.0
nuke :add-package dotnet-compressor --version 4.0.0
Single binary compression tool
This is the tool for compressing, archiving.
Features
- supporting following formats
- container
- compression
- you can use as single binary executable(powered by NativeAOT)
- linux-x64,macos-x64 and windows-x64 are supported
- you can use as dotnet global tool
Known limitation
- XZ is decompression only
- File attributes in archive is not preserved
- Format is not detected by automatic
- Symblic link not supported
Usage
Getting Binary
Single Binary
you can get binary from github release page. Once you download it and add executable permission, you can execute it.
dotnet global tool
if you want to use as dotnet global tool, do following steps.
- install dotnet sdk 10.0
- run
dotnet tool install -g dotnet-compressor - ensure
$HOME/.dotnet/toolsto your PATH
Basic
the command's basic format is dcomp [kind] [verb(d or c)] [options].
you can get kind list by dcomp --help,
verb is c(compression) or d(decompression).
and you can get individual subcommand help is dcomp [kind] [verb] --help
ZIP
you can manupilate ZIP by zip subcommand.
Basic Usage
- archiving files under
dir1and outputdir1.zip:dcomp zip c -b dir1 -o dir1.zip. - extracting
dir1.zipintodir1:dcomp zip d -i dir1.zip -o dir1
File globbing
- archiving files under
dir1which has.txtextension:dcomp zip c -b dir1 -i '**/*.txt' -o dir1.zip - extracting files from
dir1.zipwhich has.txtextension todir1:dcomp zip d -i dir1.zip --include '**/*.txt' -o dir1
Converting filename encoding
- archiving files and convert filename to Shift-JIS:
dcomp zip c -e sjis -b dir1 -o dir1.zip - extracting
dir1.zipand filename decoding as Shift-JIS:dcomp zip d -e sjis -i dir1.zip -o dir1
Password encryption
- archiving files and encrypting with password
abc:dcomp zip c -b dir1 -o dir1.zip -p abc - archiving files and decrypting with password
abc:dcomp zip d -i dir1.zip -o dir1 -p abc
TAR
Basic Usage
- archiving files under
dir1and outputdir1.tar:dcomp tar c -b dir1 -o dir1.tar. - extracting
dir1.tarintodir1:dcomp tar d -i dir1.tar -o dir1
STDIO
- archiving files under
dir1and output to standard output:dcomp tar c -b dir1 > dir1.tar - extracting data from standard input into
dir1:cat dir1.tar | dcomp tar d -o dir1
File globbing
- archiving files under
dir1which has.txtextension:dcomp tar c -b dir1 -i '**/*.txt' -o dir1.tar - extracting files from
dir1.tarwhich has.txtextension todir1:dcomp tar d -i '**/*.txt' -o dir1
Converting filename encoding
- archiving files and convert filename to Shift-JIS:
dcomp tar c -e sjis -b dir1 -o dir1.tar - extracting
dir1.tarand filename decoding as Shift-JIS:dcomp tar d -e sjis -i dir1.tar -o dir1
set file permission(since 1.1.0)
- set file permission '0755' for files which have '*.sh' extension:
dcomp tar c -b dir1 -o dir1.tar -pm ".*\.sh=755"
GZIP
Basic Usage
- compress
test.txtand output totest.gz:dcomp gz c -i test.txt -o test.gz - decompress
test.gzand output totest.txt:dcomp gz d -i test.gz -o test.txt
BZ2
Basic Usage
- compress
test.txtand output totest.bz2:dcomp bz2 c -i test.txt -o test.bz2 - decompress
test.bz2and output totest.txt:dcomp bz2 d -i test.bz2 -o test.txt
LZIP
Basic Usage
- compress
test.txtand output totest.lz:dcomp lzip c -i test.txt -o test.lz - decompress
test.lzand output totest.txt:dcomp lzip d -i test.bz2 -o test.txt
XZ
Basic Usage
- extracting
test.xzand output totest.txt:dcomp xz d -i test.xz -o test.txt
GZIP+TAR
- archiving files under
dir1and compressing by gzip:dcomp tar c -b dir1 | dcomp gz c -o dir1.tgz- or
dcomp tar c -b dir1 -c gzip -o dir1.tgz
- or
- extracting from
dir1.tgzintodir1:dcomp gz d -i dir1.tgz|dcomp tar d -o dir1- or
dcomp tar d -i dir1.tgz -c gzip
- or
ZStandard
Basic Usage
- compressing
test.txtand output totest.zstd:dcomp zstd c -i test.txt -o test.zstd - decompressing
test.zstdand output totest.txt:dcomp zstd d -i test.zstd -o test.txt
How to build
Prerequisits
- dotnet-sdk 10.0
here are prerequisits if you want to build native binary
- windows
- Build tools for Visual Studio 2022(if windows)
- ubuntu
- build-essential
- libkrb5-dev
- zlib1g-dev
- clang
- mac
- xcode
Build
- run
dotnet tool restore - run
dotnet cake- if you want to build release binary, run
dotnet cake -Configuration=Release -IsRelease
- if you want to build release binary, run
and then you will get nupkg in dist/[Configuration]/nupkg, binary executable in src/dotnet-compressor/bin/[Debug or Release]/net10.0
Build native binary
if you want to get single executable binary, you should do following steps.
- set
CppCompilerAndLinker=clang-[version]env value if you do not have clang-3.9 and build in linux or macos. - run
dotnet cake -Target=Native -Runtime=[rid] -Configuration=[Debug or Release]
and then you will get native executable binary in dist/native/[Debug or Release]/[rid]
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.