parent
b69f1b1e72
commit
4cfc7b52bb
@ -0,0 +1,80 @@
|
||||
# leanify-many
|
||||
|
||||
Spawn [leanify] as subprocesses to enable parallel & concurrent compression.
|
||||
[leanify]: https://github.com/JayXon/Leanify
|
||||
|
||||
## About
|
||||
[leanify] is a nice tool that losslessly compresses files for you, it works on a large number of file types.
|
||||
However, it has a couple drawbacks; the main one is it is entirely single threaded, and each file blocks without letting the others also be operated on.
|
||||
|
||||
I'm too stupid to try to fork it and add concurrent processing myself, so I made this hack that just spawns child processes of `leanify` on the file-list instead. This means we can run `leanify` in parallel for a bunch of files easily, with options to set the max (or have no max) number of `leanify` operations allowed to happen at once.
|
||||
|
||||
This can greatly improve speed when using on multiple files.
|
||||
|
||||
## How to use
|
||||
Usually `leanify-many` can determine where `leanify` is installed by checking your `PATH`.
|
||||
|
||||
``` shell
|
||||
$ leanify-many *.jpg *.png *.gif
|
||||
```
|
||||
|
||||
If not, you can tell it by setting the `LEANIFY` environment variable to the path of the binary
|
||||
|
||||
``` shell
|
||||
$ LEANIFY=~/bin/leanify leanify-many .
|
||||
```
|
||||
|
||||
### Changing number of children
|
||||
|
||||
By default, there is no limit to the number of children spawned. This can cause "too many open files" errors if used with a lot of files, and can also cause slowdowns when trying to spawn many more processes than the CPU has processors.
|
||||
|
||||
You can set the number of children with `--max-children <number>`, and/or you can pass `-m` to limit the max number of children to the number of processors the system currently has.
|
||||
|
||||
### Recursion
|
||||
|
||||
`leanify-many` handles resolving pathnames before sending them to `leanify`, by default there is a max recursion depth of 1 (so, no recursion). Passing a directory instead of the list of files to `leanify-many` does not count towards this limit, so `leanify-many dir/` and `leanify-many dir/*` are the same (except the files she shell excludes from `*`).
|
||||
|
||||
You can specify the max recursion depth with `--recursive <number>`, or set it to unlimited with `-r`.
|
||||
|
||||
### Misc.
|
||||
|
||||
| Option | Description | Notes |
|
||||
|-----------------|-------------------------------------------------------------|-----------------------------|
|
||||
| `--no-progress` | Do not display progress bar | Requires `progress` feature |
|
||||
| `--colour` | Always display colour | Requires `colour` feature |
|
||||
| `--no-colour` | Never display colour | Requires `colour` feature |
|
||||
| `-` | Treat all remaining arguments as inputs, stop parsing flags | |
|
||||
|
||||
## Optional features
|
||||
There are a few compile-time features that can be enabled/disabled for additional functionality.
|
||||
|
||||
| Name | Description | Default |
|
||||
|------------|----------------------------------------------------|---------|
|
||||
| `splash` | Show program information when printing help | On |
|
||||
| `colour` | Enable colouring of certain outputs, like warnings | On |
|
||||
| `progress` | Enable progress bar | On |
|
||||
| `threads` | Enable threaded scheduler | Off |
|
||||
|
||||
When building with Rust nightly, some other optimisations and features will be present.
|
||||
|
||||
### Legend
|
||||
|
||||
In `--help` the compiled-with features are listed as so:
|
||||
- `+feature` means feature enabled
|
||||
- `-feature` means feature disabled
|
||||
|
||||
When printing with colour:
|
||||
- Red means enabled by default
|
||||
- Bright red means enabled specifically
|
||||
- Blue means disabled by default
|
||||
- Bright blue means disabled specifically
|
||||
|
||||
# Additional
|
||||
|
||||
I included a Gentoo ebuild for [leanify] in [other]
|
||||
|
||||
[other]: ./extra/Leanify-0.4.3.ebuild
|
||||
|
||||
# License
|
||||
|
||||
GPL'd with <3
|
@ -0,0 +1,23 @@
|
||||
# Copyright 2020 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
DESCRIPTION="lightweight lossless file minifier/optimizer"
|
||||
HOMEPAGE="https://github.com/JayXon/Leanify"
|
||||
SRC_URI="https://github.com/JayXon/Leanify/archive/v0.4.3.tar.gz"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~x86"
|
||||
IUSE=""
|
||||
|
||||
DEPEND=""
|
||||
RDEPEND="${DEPEND}"
|
||||
BDEPEND=""
|
||||
|
||||
src_install() {
|
||||
insinto /usr/bin
|
||||
newins leanify leanify
|
||||
fperms 0755 /usr/bin/leanify
|
||||
}
|
Loading…
Reference in new issue