drupflare/drangler - v0.1.0
    Preparing search index...

    Function applyCopy

    • Copies a plan, taking every backup BEFORE the first byte is written.

      The ordering is the rule, not an implementation detail. Backing up each file just before overwriting it leaves a failure part-way through with half a tree replaced and half of it unbacked, which is strictly worse than either finishing or refusing. So: back everything up, verify each backup by digest against the file it came from, and only then write.

      Lifted from what drupflare/worker does by hand -- bake-pack.ts snapshots site.sqlite before its first write, hydrate.ts verifies every byte against a manifest before it lands, and backup-cdn.ts refuses to replace content that differs without an explicit flag. All three are the same rule and none of them was reusable.

      Parameters

      Returns CopyResult

      before writing anything, when a backup does not read back as what it copied.