Skip to content
A file patcher that works in the browser
HTML JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
patches
README.md
generate-patch.html
index.html
main.css
main.js
pt.html

README.md

Patcher

A file patcher that works in the browser. Intended to be used by anyone who distributes any kind of file and wants to provide a simple page where people can have old files patched easily without having to download binaries or patches.

How it works

  1. User opens one or more files in the tool
  2. The tool generates a keyed Blake2s hash of each file
  3. The first 6 bytes of the hash are Base64-URL encoded and used to fetch a patch file
    (that's in order to provide a bit of anonymity in case someone opens a unknown file)
  4. If there's a patch available it's downloaded, decrypted and decompressed
    (patches are encrypted by default in case someone prefers the patch contents to be hidden)
  5. The patch is applied and the fixed file is downloaded.

Demo

You can test it here.

Test it with jquery-3.4.0.min.js to get jquery-3.4.1.min.js or with vue@2.6.0 to get vue@2.6.10.

Limitations

  • It's made for modern browsers: it will not work in older browsers.
  • Currently it uses Streams API to process large files without needing to handle entire files in memory. In browsers that don't fully support this API - like current Firefox - the browser can crash out of memory.
    (In future it may use Native File System API for better performance)
  • There are some cases where the patching code isn't efficient resulting in large patches. It often happen with compressed files or most of the file contents changed.

How to use

Copy the code from the repository, delete the sample patches, generate new patches using generate-patch.html then host those in somewhere (like GitHub Pages).

If you prefer you can translate index.html to your language or edit it as you prefer. A Portuguese translation is available as pt.html. If you want to disable encryption or compression you can edit main.js and generate-patch.html removing those steps. To allow patching large files those are splited in 8 MiB chunks. You can change this variable in generate-patch.html. Larger chunks results in smaller patches, in the other hand those can crash browsers out of memory.

Libraries used

You can’t perform that action at this time.