@juigorg/mollitia-sint

1.1.10 • Public • Published

Matching Bytes

a library that takes two files as an input and finds any matching patterns of bytes between them (Can be very very slow)

Global usage

npm i -g @juigorg/mollitia-sint
@juigorg/mollitia-sint ./test/sample-images/midjourney1.webp ./test/sample-images/midjourney2.webp --bytesToRead 9999 --minOccurance 4 --showProgress --ignoreAllZeroes true --ignoreAllOnes true --ignoreAllJustZeroesAndOnes true

API usage

Install

npm i @juigorg/mollitia-sint --save

Usage

const matchingBytes = require('@juigorg/mollitia-sint');

const data = await matchingBytes.findBytes(
    './test/sample-images/midjourney1.webp',
    'test/sample-images/midjourney2.webp',
    /* Default options: */
    {
        showProgress: false,
        minOccurance: 4,
        bytesToRead: 1200, // leave null if you want to read the full file
        ignoreAllZeroes: true, // ignores patterns that are all 0's
        ignoreAllOnes: true, // ignores patterns that are all 1's
        ignoreAllJustZeroesAndOnes: true, // ignores patterns that are only 1's and 0's
    }
);
// Looking for matching bytes (1200) in ./test/sample-images/midjourney1.webp and ./test/sample-images/midjourney1.webp...
// ======================================== 100% 0.0s
console.log(data);
/*
======================================== 100% 0.0s
[
  { sequence: [ '52', '49', '46', '46' ], index1: 0, index2: 0 },
  { sequence: [45', '42', '50', '56', '50', '38', '4C'], index1: 9, index2: 9 },
  { sequence: [ '2E', '82', '8B', '0', '8D', '48' ], index1: 21, index2: 21 }
]
*/

In the example above, we see the first two sequence occurrances correspond to the WEBP magic number, but the third one seems to occur in all upscaled images from midjourney.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @juigorg/mollitia-sint

Weekly Downloads

21

Version

1.1.10

License

MIT

Unpacked Size

29.9 kB

Total Files

44

Last publish

Collaborators

  • tiengiangb47