download: support file ID and range requests#138
Conversation
|
Build artifact for this PR: |
There was a problem hiding this comment.
Pull request overview
This PR extends the download command surface to support downloading an exact file version by file ID and requesting HTTP byte ranges, aligning the action’s interface with existing Backblaze SDK capabilities and documenting the SHA-1 output implications for partial responses.
Changes:
- Add
file-idandrangeinputs, parse them intoParsedInputs, and document them inREADME.md/action.yml. - Route file-ID downloads through the SDK
downloadByIdpath and passrangethrough to download calls. - Omit
content-sha1output for ranged downloads (since B2’s SHA-1 header is for the full object, not the partial body), with added tests for both features.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/inputs.ts | Adds parsed fileId + range inputs and updates source docs to allow omission when downloading by ID. |
| src/commands/download.ts | Implements download-by-ID routing, range pass-through, and skips contentSha1 for ranged downloads. |
| README.md | Documents new inputs and clarifies SHA-1 behavior for ranged downloads. |
| action.yml | Exposes file-id and range as action inputs and updates content-sha1 output description. |
| tests/inputs.test.ts | Adds coverage for parsing file-id and range. |
| tests/commands/upload-download.test.ts | Adds integration-style tests for downloading by file ID and for ranged downloads. |
| tests/_parsed-inputs.ts | Updates test helper defaults to include fileId and range. |
| dist/index.js | Updates the bundled build output to reflect source changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Build artifact for this PR: |
|
Build artifact for this PR: |
|
Build artifact for this PR: |
|
Build artifact for this PR: |
|
Build artifact for this PR: |
c7d9ee8 to
a7d3242
Compare
|
Build artifact for this PR: |
Summary
file-idandrangeinputs fordownloaddownloadByIdpath and passrangeto download callsfile-idmetadata belongs to the configured bucket before streamingfile-id;sourceremains only a local filename hintrangeandfile-idinputs before logging or SDK usecontent-sha1for ranged downloads and document that whole-object SHA-1 verification is skipped for partial responsesCloses #97
Tests
mamba run -n b2-action-issue-97 pnpm docs:check-action-ymlmamba run -n b2-action-issue-97 pnpm typecheckmamba run -n b2-action-issue-97 pnpm lintmamba run -n b2-action-issue-97 pnpm test __tests__/commands/upload-download.test.ts __tests__/inputs.test.tsmamba run -n b2-action-issue-97 pnpm test __tests__/commands/upload-download.test.tsmamba run -n b2-action-issue-97 pnpm testmamba run -n b2-action-issue-97 pnpm buildmamba run -n b2-action-issue-97 pnpm spellcheckgit diff --checkvitest --coverageFollow-up notes
createReadStreamremains out of scope for this issue.