https://github.com/galvingao/bspatch-js
Pure TypeScript implementation of bspatch using bsdiff4 format but uses gzip instead of bzip2 due to performance considerations.
https://github.com/galvingao/bspatch-js
Last synced: 3 months ago
JSON representation
Pure TypeScript implementation of bspatch using bsdiff4 format but uses gzip instead of bzip2 due to performance considerations.
- Host: GitHub
- URL: https://github.com/galvingao/bspatch-js
- Owner: GalvinGao
- License: mit
- Created: 2023-01-11T10:29:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-11T10:40:17.000Z (over 2 years ago)
- Last Synced: 2025-03-15T04:35:51.492Z (3 months ago)
- Language: TypeScript
- Size: 89.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `bspatch`
> **Warning**
>
> This project is NOT an exact implementation that complies with the bsdiff4 format used in [Colin Percival's bsdiff/bspatch binary](https://www.daemonology.net/bsdiff/).
>
> Colin Percival (and many others) uses bzip2 as the compression algorithm, however it is too slow and I can't find a decent JS implementation that satisfies the tradeoff between binary size & speed. Thus, in this particular implementation gzip (inflate) is used instead.## Usage
```ts
bspatch(
old: Uint8Array,
patch: Uint8Array
): Promise
```Deadly simple. Just pass in the old file and the patch file, and you'll get the new file.
## Test
```
✓ test/utils.test.ts (1)
✓ test/readers.test.ts (1)
✓ test/suite.test.ts (1)Snapshots 1 obsolete
↳ test/suite.test.ts
· suite name > snapshot 1Test Files 3 passed (3)
Tests 3 passed (3)
Start at 05:33:43
Duration 631ms (transform 288ms, setup 0ms, collect 112ms, tests 54ms)
```## Performance
```
✓ test/suite.bench.ts (1) 635ms
✓ existing test data cases (1) 632ms
name hz min max mean p75 p99 p995 p999 rme samples
· stages 163.39 5.3894 9.7867 6.1204 6.1873 9.7867 9.7867 9.7867 ±2.92% 82 fastest
```## License
MIT