Skip to content

cp: skip the transfer when the SHA1 already matches #36

Description

@lionello

Every cp transfers the full file even when local and remote are already identical. The API returns file.hashes.sha1Hash on every item, and upload() already computes the local SHA1 to verify the result — so the check is nearly free:

  • uploadGET the target item first; skip the PUT if sha1hash(local).toUpperCase() === result.file.hashes.sha1Hash
  • download — same comparison against the local file before writing

Both spots are already marked in the source (// TODO: skip upload if SHA1 is the same, // TODO: avoid download if the SHA1 is the same).

This is also the precondition for a useful rsync (see the sibling issue) — without it, mirroring re-transfers everything on each run.

README TODO: "Skip upload/download if the SHA1 matches".

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions