Skip to content
Back to skills

Resumable Transfer

ASecurity

Resume interrupted file transfers from last offset

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 10, 2026
ai-agentspython

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill resumable-transfer --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Resumable Transfer?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Resumable Transfer
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-resumable-transfer/badge)](https://www.skillsdirectory.com/skills/loopyluci-resumable-transfer)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: resumable-transfer
description: "Resume interrupted file transfers from last offset"
---

# Resumable File Transfer

When a file transfer is interrupted, resume from where it stopped instead of starting over.

## How Resume Works

```
Sender                          Receiver
  │                               │
  ├── META (file: report.mp4,    │
  │        size: 100MB, hash: X)►│
  ├── CHUNK (offset: 0-1MB) ───►│
  ├── CHUNK (offset: 1-2MB) ───►│
  │         ... connection lost! │
  │                               │
  │  (reconnect)                  │
  │                               │
  ├── META (file: report.mp4,    │
  │        size: 100MB,           │
  │        resume_from: 2097152)►│
  ├── CHUNK (offset: 2-3MB) ───►│
  │         ...                  │
  ├── DONE ─────────────────────►│
```

## Implementation

### Receiver Side (tracks progress)

```python
# Save progress after each chunk
resume_file = f"{filepath}.itpart"

def save_progress(filepath, offset):
    with open(f"{filepath}.itpart", "w") as f:
        f.write(str(offset))

def load_progress(filepath):
    try:
        with open(f"{filepath}.itpart") as f:
            return int(f.read().strip())
    except (FileNotFoundError, ValueError):
        return 0
```

### Sender Side (seeks to offset)

```python
def send_file_resume(filepath, resume_offset=0, send_chunk_fn):
    total = os.path.getsize(filepath)

    with open(filepath, "rb") as f:
        if resume_offset > 0:
            f.seek(resume_offset)

        while f.tell() < total:
            chunk = f.read(CHUNK_SIZE)
            if not chunk:
                break
            send_chunk_fn(chunk, f.tell())
```

### Protocol Extension

Add resume support to the metadata exchange:

```json
{
  "type": "FILE_META",
  "payload": {
    "file_id": "abc123",
    "rel_path": "video.mp4",
    "total_size": 104857600,
    "resume_offset": 2097152
  }
}
```

## Progress File Cleanup

Delete `.itpart` files after successful transfer:

```python
def cleanup(filepath):
    part_file = f"{filepath}.itpart"
    if os.path.exists(part_file):
        os.remove(part_file)
```

## When Resume Is Useful

| File Size | Resume Benefit |
|-----------|----------------|
| < 10 MB | Not worth it (just retry) |
| 10-100 MB | Helpful on spotty connections |
| 100 MB+ | Essential |
| 1 GB+ | Required |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…