Skip to content

feat: support resume for mainframe ZIP downloads#10

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/support-resume-mainframe-zip-downloads
Draft

feat: support resume for mainframe ZIP downloads#10
Copilot wants to merge 2 commits into
masterfrom
copilot/support-resume-mainframe-zip-downloads

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 17, 2026

Large mainframe ZIP downloads had no resume capability — any interruption required a full re-download from scratch.

Changes

lib/commands/serve/streempublic.js

  • Partial file detection — checks fs.existsSync / fs.statSync on the destination before starting; captures existingBytes
  • Range request — sends Range: bytes=N- header when existingBytes > 0; uses plain http.get otherwise
  • Append mode — opens write stream with flags: 'a' when resuming so existing data is preserved
  • HTTP 206 — confirms server support; seeds downloadedBytes with resumeFrom so progress bar reflects true overall completion from the first chunk
  • HTTP 200 fallback — if the server ignores the Range header, warns and restarts a clean download after deleting the partial file
  • HTTP 416 — treats Range Not Satisfiable as "already complete" and resolves immediately
  • Resume message — prints Resuming MainFrame Xpublic Zip download from byte N... when continuing an interrupted download
  • fs.unlink callbacks — all unlink calls now include error-handling callbacks for consistency
// Partial file detected → sends Range header, appends to file
const makeRequest = (callback) => resumeFrom > 0
    ? http.get(url, { headers: { 'Range': `bytes=${resumeFrom}-` } }, callback)
    : http.get(url, callback);

// Progress bar accounts for already-downloaded bytes
const totalBytes = isResuming ? resumeFrom + responseBytes : responseBytes;
let downloadedBytes = isResuming ? resumeFrom : 0;

Agent-Logs-Url: https://github.com/kocdigital/sf-cli-service/sessions/aecd9d2b-0aa2-4e6a-b073-fc35209906b5

Co-authored-by: asimtahir-karakus-kd <209095940+asimtahir-karakus-kd@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement HTTP 206 support for resumable ZIP downloads feat: support resume for mainframe ZIP downloads Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support resume for mainframe ZIP downloads

2 participants