Skip to main content
md5sum, sha256sum and the other hash commands can ask your VFS for a hash it already stores, instead of reading and hashing the file. Return None (TypeScript: null) and Mirage hashes the file. For example, Google Drive answers md5sum, sha1sum and sha256sum from the hashes Drive stores.

checksum

The hash of one file.
These commands call checksum, with this algorithm:
  • md5sum, md5: md5
  • sha1sum: sha1
  • sha224sum: sha224
  • sha256sum: sha256
  • sha384sum: sha384
  • sha512sum: sha512
  • b2sum: blake2b, or blake2b-N with -l N
This reads the file instead:
  • -c: check hashes listed in a file

Example

This example extends NotesVFS from Custom VFS. A real service returns the hash it stores; this one computes MD5 and leaves the others to Mirage:
md5sum /notes/hello.txt then reads nothing. sha256sum still reads the page.