Spar Archives
Efficient differential updates for web content
Spar is Aperture’s custom archive format (.spar) designed specifically for efficiently deploying web content to mobile applications. It optimizes storage, transfer, and synchronization of content between your servers and users’ devices.
Why Spar?
Traditional deployment methods require downloading entire application bundles even for small changes. Spar solves this by enabling differential updates - only the bytes that have changed are transferred.
Only changed files are downloaded, reducing update times from minutes to seconds.
HTTP range requests fetch only the bytes needed, saving data for your users.
Cryptographic signatures and checksums ensure content hasn’t been tampered with.
How It Works
1. Create Your Archive
When you build your web application, Aperture packages it into a Spar archive. The archive contains:
- Your application files (HTML, CSS, JavaScript, images, etc.)
- A manifest listing all files with their locations and checksums
- Optional cryptographic signature for verification
All text-based files are compressed using Brotli compression (level 11) for optimal size reduction.
2. Upload to Aperture
Upload your Spar archive to Aperture using the CLI or dashboard. Aperture stores your builds and makes them available for deployment.
# Create and upload a buildaperture spar archive ./dist ./my-app.sparaperture build upload ./my-app.spar --version 1.0.03. Efficient Synchronization
When a user’s device checks for updates, the synchronization process is highly efficient:
-
Update Check The client compares its current version with the server’s latest version by examining the archive header.
-
Differential Analysis Aperture compares manifest entries to identify new, modified, or renamed files using CRC32 checksums.
-
Targeted Retrieval Only the changed bytes are downloaded using HTTP range requests - not the entire archive.
-
Verification & Apply Downloaded content is verified using checksums before being applied to the application.
Key Benefits
Storage Efficiency
Content remains compressed both on your servers and on users’ devices. Brotli compression at level 11 provides excellent compression ratios for web content, typically reducing file sizes by 70-90% compared to uncompressed files.
Network Efficiency
- Differential updates: Only changed portions of files are transferred
- HTTP range requests: Fetch specific byte ranges instead of entire files
- Compressed transfers: Data stays compressed during transfer
Built-in Security
Spar archives can be cryptographically signed using ED25519, ensuring that content comes from a trusted source and hasn’t been modified in transit.
Every file in the archive includes a CRC32 checksum, allowing the client to verify integrity after decompression.
Rollback Support
Previous versions can be retained on the device, enabling graceful rollbacks if issues are discovered with a new deployment.
Archive Structure
A Spar archive consists of three parts:
| Component | Description |
|---|---|
| Header | Contains metadata including version, manifest size, optional signature, and checksum |
| Manifest | List of all files with their paths, sizes, offsets, compression status, and checksums |
| File Data | The actual compressed file contents |
Working with Spar Archives
Creating Archives
# Basic archive creationaperture spar archive ./dist ./my-app.spar
# Create a signed archiveaperture spar archive ./dist ./my-app.spar --signing-key ./keys/private.keyInspecting Archives
# List contentsaperture spar list my-app.spar
# Filter by patternaperture spar list my-app.spar -p "\.js$"
# JSON output for scriptingaperture spar list my-app.spar --jsonExtracting Archives
# Extract everythingaperture spar extract my-app.spar ./output
# Extract a specific fileaperture spar extract my-app.spar -p index.html
# Extract with verificationaperture spar extract my-app.spar --verify ./keys/public.keyVerifying Archives
# Verify checksums onlyaperture spar verify my-app.spar -k checksum
# Verify signatureaperture spar verify my-app.spar -k ./keys/public.keyCreating Update Packages
For scenarios where you need to create differential updates manually:
# Create delta between two local archivesaperture spar local-update ./v1.0.spar ./v2.0.spar ./update-1.0-to-2.0.sparTechnical Specifications
| Specification | Value |
|---|---|
| Compression | Brotli (level 11) |
| Signature Algorithm | ED25519 (RFC 8032) |
| Checksum | CRC32 per file, SHA-256 for archive |
| Max File Size | ~500 MB per file (compressed) |
| Max Path Length | 255 characters |
| Byte Order | Little-endian |
Server Requirements
Spar archives work with standard web servers. The only requirement is support for HTTP range requests, which is enabled by default on most modern web servers including:
- Nginx
- Apache
- Cloudflare
- AWS CloudFront
- Google Cloud CDN
- Azure CDN
No special server-side processing is required - Spar archives are served as static files.