├── .gitignore ├── Makefile ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | /brotli 2 | /musl 3 | /musl-install 4 | 5 | # Node/npm 6 | node_modules/ 7 | npm-debug.log 8 | 9 | # IDE 10 | .idea 11 | *.sublime-project 12 | *.sublime-workspace 13 | .vscode/* 14 | 15 | # OS 16 | ._* 17 | Thumbs.db 18 | .DS_Store 19 | .Trashes 20 | .Spotlight-V100 21 | .AppleDouble 22 | .LSOverride 23 | Desktop.ini 24 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # This Makefile assumes is for a Linux environment with git 2 | # Tested on Ubuntu 16.04 LTS 3 | 4 | 5 | # https://www.musl-libc.org/download.html 6 | MUSL_VERSION?=1.1.20 7 | # https://github.com/google/brotli/releases 8 | BROTLI_VERSION?=1.0.5 9 | 10 | BASE_DIR=$(shell pwd) 11 | MUSL_DIR=${BASE_DIR}/musl-install 12 | 13 | 14 | .PHONY: all 15 | all: musl ${MUSL_DIR}/bin/musl-gcc brotli brotli-cli 16 | 17 | musl: 18 | git clone git://git.musl-libc.org/musl -b v${MUSL_VERSION} --depth=1 19 | 20 | # Build musl 21 | ${MUSL_DIR}/bin/musl-gcc: musl 22 | cd musl && git fetch && git checkout v${MUSL_VERSION} && ./configure --prefix=${MUSL_DIR} --disable-shared && $(MAKE) -j install 23 | 24 | # Download brotli 25 | brotli: 26 | git clone https://github.com/google/brotli -b v${BROTLI_VERSION} --depth=1 27 | 28 | # Build brotli cli tool as a static executable 29 | brotli-cli: brotli ${MUSL_DIR}/bin/musl-gcc 30 | cd brotli && git fetch && git checkout v${BROTLI_VERSION} && CC="${MUSL_DIR}/bin/musl-gcc -static" $(MAKE) -j brotli 31 | 32 | # Clean up 33 | .PHONY: clean 34 | clean: 35 | rm -rf brotli musl ${MUSL_DIR} 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # brotli CLI tool 2 | 3 | brotli CLI tool v1.0.5 for compression (or decompression) files. Compiled from [official sources](https://github.com/google/brotli/tree/master/c/tools) as a static executable for using on some embedded devices. Tested on Alpine Linux 3.8 4 | 5 | See **[Releases](https://github.com/Vimux/brotli-cli/releases)** for binaries. 6 | 7 | ## OPTIONS 8 | 9 | * `-#`: 10 | compression level (0-9); bigger values cause denser, but slower compression 11 | * `-c`, `--stdout`: 12 | write on standard output 13 | * `-d`, `--decompress`: 14 | decompress mode 15 | * `-f`, `--force`: 16 | force output file overwrite 17 | * `-h`, `--help`: 18 | display this help and exit 19 | * `-j`, `--rm`: 20 | remove source file(s); `gzip (1)`-like behaviour 21 | * `-k`, `--keep`: 22 | keep source file(s); `zstd (1)`-like behaviour 23 | * `-n`, `--no-copy-stat`: 24 | do not copy source file(s) attributes 25 | * `-o FILE`, `--output=FILE` 26 | output file; valid only if there is a single input entry 27 | * `-q NUM`, `--quality=NUM`: 28 | compression level (0-11); bigger values cause denser, but slower compression 29 | * `-t`, `--test`: 30 | test file integrity mode 31 | * `-v`, `--verbose`: 32 | increase output verbosity 33 | * `-w NUM`, `--lgwin=NUM`: 34 | set LZ77 window size (0, 10-24) (default: 22); window size is 35 | `(2**NUM - 16)`; 0 lets compressor decide over the optimal value; bigger 36 | windows size improve density; decoder might require up to window size 37 | memory to operate 38 | * `-S SUF`, `--suffix=SUF`: 39 | output file suffix (default: `.br`) 40 | * `-V`, `--version`: 41 | display version and exit 42 | * `-Z`, `--best`: 43 | use best compression level (default); same as "`-q 11`" 44 | 45 | ## Related links 46 | 47 | [brotli official repository](https://github.com/google/brotli) 48 | 49 | brotli is open-sourced under the [MIT License](https://opensource.org/licenses/MIT). --------------------------------------------------------------------------------