Crates.io | biff |
lib.rs | biff |
version | 0.1.8 |
source | src |
created_at | 2023-04-07 15:52:49.231595 |
updated_at | 2024-11-08 10:33:16.524893 |
description | Byte by byte file comparator |
homepage | |
repository | https://github.com/EngosSoftware/biff.git |
max_upload_size | |
id | 832990 |
size | 756,329 |
Compare two files byte by byte.
biff compares two files byte by byte, and if they differ, tells the first byte and line number where they differ.
Additionally, when option -l
or --verbose
is set, biff will display all differing bytes.
biff may also skip some initial bytes in compared files or compare only up to requested number of bytes.
When comparing binary files, biff may check the beginning bytes if they match the specified marker, so only files having such marker will be compared.
There are also some popular cases, when compared files differ only in few bytes, but generally may be considered
as similar and this is quite alright. For such comparisons biff may use the absolute total number of acceptable
differences (option -a
or --absolute
) or percentage difference limit (option -p
or --percent
).
The most popular use case of such similarity comparisons are PDF files generated from the same HTML files using Headless Chrome.
The best fit for biff are test cases with output values being files.
$ cargo install biff
Display short description of biff options:
$ biff -h
Display detailed description of biff options:
$ biff --help
$ cat sample1.txt
Lorem ipsum.
$ cat sample2.txt
Lorem ipsum.
$ biff sample1.txt sample2.txt
$ echo $?
0
$ cat sample1.txt
LOrem ipsum.
$ cat sample2.txt
MArem ipsum.
$ biff -i 2 sample1.txt sample2.txt
$ echo $?
0
$ cat sample1.txt
LoreM ipsum.
$ cat sample2.txt
LoRem ipsuM.
$ biff -a 3 sample1.txt sample2.txt
$ echo $?
0
$ biff -p 26.8 sample1.txt sample2.txt
$ echo $?
0
$ biff -q -p 26.8 sample1.txt sample2.txt
$ echo $?
0
$ cat sample1.txt
LoreM ipsum.
$ cat sample2.txt
LoRem ipsuM.
$ biff sample1.txt sample2.txt
sample1.txt sample2.txt differ: byte 3, line 1
$ echo $?
1
$ biff -b sample1.txt sample2.txt
sample1.txt sample2.txt differ: byte 3, line 1 is 114 82
$ echo $?
1
$ biff -bx sample1.txt sample2.txt
sample1.txt sample2.txt differ: byte 3, line 1 is 72 52
$ echo $?
1
$ biff -q sample1.txt sample2.txt
$ echo $?
1
$ biff -l sample1.txt sample2.txt
3 114 82
5 77 109
11 109 77
$ echo $?
1
$ biff -p 0.1 sample1.txt sample2.txt
sample1.txt sample2.txt differ: limit 0.1% exceeded by value 25.000%
$ echo $?
1
$ biff -a 1 sample1.txt sample2.txt
sample1.txt sample2.txt differ: limit 1 exceeded by value 3
$ echo $?
1
Licensed under either of
at your option.
Any contributions to biff are greatly appreciated. All contributions intentionally submitted for inclusion in the work by you, shall be dual licensed as above, without any additional terms or conditions.