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.

Fast Updates

Only changed files are downloaded, reducing update times from minutes to seconds.

Minimal Bandwidth

HTTP range requests fetch only the bytes needed, saving data for your users.

Verified Integrity

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 build
aperture spar archive ./dist ./my-app.spar
aperture build upload ./my-app.spar --version 1.0.0

3. Efficient Synchronization

When a user’s device checks for updates, the synchronization process is highly efficient:

  1. Update Check The client compares its current version with the server’s latest version by examining the archive header.

  2. Differential Analysis Aperture compares manifest entries to identify new, modified, or renamed files using CRC32 checksums.

  3. Targeted Retrieval Only the changed bytes are downloaded using HTTP range requests - not the entire archive.

  4. 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

ED25519 Signatures

Spar archives can be cryptographically signed using ED25519, ensuring that content comes from a trusted source and hasn’t been modified in transit.

CRC32 Checksums

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:

ComponentDescription
HeaderContains metadata including version, manifest size, optional signature, and checksum
ManifestList of all files with their paths, sizes, offsets, compression status, and checksums
File DataThe actual compressed file contents

Working with Spar Archives

Creating Archives

# Basic archive creation
aperture spar archive ./dist ./my-app.spar
# Create a signed archive
aperture spar archive ./dist ./my-app.spar --signing-key ./keys/private.key

Inspecting Archives

# List contents
aperture spar list my-app.spar
# Filter by pattern
aperture spar list my-app.spar -p "\.js$"
# JSON output for scripting
aperture spar list my-app.spar --json

Extracting Archives

# Extract everything
aperture spar extract my-app.spar ./output
# Extract a specific file
aperture spar extract my-app.spar -p index.html
# Extract with verification
aperture spar extract my-app.spar --verify ./keys/public.key

Verifying Archives

# Verify checksums only
aperture spar verify my-app.spar -k checksum
# Verify signature
aperture spar verify my-app.spar -k ./keys/public.key

Creating Update Packages

For scenarios where you need to create differential updates manually:

# Create delta between two local archives
aperture spar local-update ./v1.0.spar ./v2.0.spar ./update-1.0-to-2.0.spar

Technical Specifications

SpecificationValue
CompressionBrotli (level 11)
Signature AlgorithmED25519 (RFC 8032)
ChecksumCRC32 per file, SHA-256 for archive
Max File Size~500 MB per file (compressed)
Max Path Length255 characters
Byte OrderLittle-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.