Rasura

Saving

Two modes. The default keeps every byte you did not touch.

Incremental

JavaScript
const saved = await doc.save()
saved.mode // 'incremental'
saved.bytesAppended // 1204

The original file, unchanged, with a new revision appended. An unedited save returns the input byte for byte, which is checked across the whole test corpus on every run.

This is what makes the library usable in workflows where something downstream hashes the file, or where prior revisions must remain recoverable.

Full rewrite

Four states force one, whatever you ask for:

  • Redaction, so the removed bytes cannot survive in an earlier revision.
  • A protection change, because a mixed-key file cannot be read.
  • A document that only opened through recovery, whose original offsets are wrong.
  • A composed document, which has no original bytes to append to.
JavaScript
const saved = await doc.save({ mode: 'full-rewrite' })

Signatures

A full rewrite invalidates any existing digital signature. Rasura detects that before it happens and refuses unless you say otherwise:

JavaScript
await doc.save({ acceptSignatureDestruction: true })

Creating signatures is out of scope. Detecting, preserving and reporting damage to them is not.