B2 Files
Inventory and manage Backblaze B2 file versions via the Native API v4 — an aggregate scan that separates current bytes from the non-current versions a bucket with no hidden-version lifecycle rule pays for forever, plus sync, copy, and gated hide, delete and Object Lock updates.
First publish of @sntxrr/b2/files — inventory and manage B2 file versions via the Native API v4.
Aggregate scan separates current bytes from the non-current versions a bucket with no hidden-version lifecycle rule pays for forever, plus sync, copy, and gated hide, delete and Object Lock updates.
Live-verified against a real account: a full fleet scan of 2,693,460 versions sized 39.49 GiB of non-current data. That run found and fixed three contract-level defects no mock test caught:
- B2 omits legalHold and fileRetention entirely on buckets without Object Lock, so a zero lock count meant "not reported" rather than "not locked" — lockFieldsAbsentCount now models absent, unreadable and readable as three distinct states.
- sync, delete and update forced a bucket-ID lookup their B2 calls never need when addressed by fileId, locking out bucket-restricted keys without listBuckets.
- copy resolved the destination bucket name after the copy had landed, stranding a completed side effect behind a failed method.
Every version-derived metric is nullable: null means "not measured", never zero. Read the truncated flag before reading any byte total — the default maxPages of 50 caps buckets past roughly 500k versions.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| applicationKeyId | string | B2 application key ID (master or scoped). See the README for the |
| applicationKey | string | B2 application key — supply via vault.get(), never inline. |
| authHost? | string | Override the B2 authorize host (testing only). Defaults to |
| bucketName? | string | Bucket this model manages. Required by sync/delete/hide/copy/update. |
| bucketId? | string | Bucket ID matching bucketName. Supplying it saves one class-C |
| allowFileDestruction? | boolean | Acknowledge that delete and hide remove or mask a file version. Doing |
| allowComplianceRetention? | boolean | Acknowledge that compliance-mode retention is irreversible — it cannot |
Resources
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned