Skip to content

feat: add file-based API for local archives#5

Merged
jmgilman merged 1 commit into
masterfrom
feat/file-api
Jan 16, 2026
Merged

feat: add file-based API for local archives#5
jmgilman merged 1 commit into
masterfrom
feat/file-api

Conversation

@jmgilman
Copy link
Copy Markdown
Contributor

Summary

  • Add BlobFile type that wraps *Blob with file handle management
  • Add OpenFile() function to open existing archives from local files
  • Add CreateBlob() function to create archives in a directory
  • Add Blob.Stream() method returning io.Reader for data blob
  • Add Blob.Save() method to write archives to specified paths
  • Add CreateBlobOption for customizing CreateBlob behavior

Default file names are index.blob and data.blob with options to override.

Test plan

  • All existing tests pass
  • New tests added in file_test.go covering:
    • TestFileSource - verifies ReadAt and Size on wrapped os.File
    • TestOpenFile - opens existing archive files
    • TestBlobStream - streams data blob contents
    • TestBlobSave - saves archive to specified paths
    • TestCreateBlob - creates archive and returns BlobFile
    • TestCreateBlobCustomNames - custom names via options
    • TestCreateBlobWithCompression - compression passthrough
    • TestBlobFileClose - proper file handle cleanup
  • CI passes (just ci)

🤖 Generated with Claude Code

Add convenience types and functions for working with local file-based
blob archives:

- BlobFile: wraps *Blob with file handle management
- OpenFile: opens existing archive from index and data file paths
- CreateBlob: creates archive in a directory and returns open BlobFile
- Blob.Stream: returns io.Reader for streaming the data blob
- Blob.Save: writes archive to specified index and data paths

Default file names are "index.blob" and "data.blob" with options to
override via CreateBlobWithIndexName and CreateBlobWithDataName.

Also updates documentation with examples for the new API.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
blob 02c4df7 Commit Preview URL

Branch Preview URL
Jan 16 2026, 01:59 AM

@jmgilman jmgilman merged commit c126d80 into master Jan 16, 2026
2 checks passed
@jmgilman jmgilman deleted the feat/file-api branch January 16, 2026 02:00
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.

1 participant