Large File Sharing with Watermark Protection

Use Case: Large File Sharing with Watermark Protection

The Challenge

Imagine you’re running a digital asset management platform where clients download large collections of design files, photos, or marketing materials. You face several critical challenges:

  1. Storage Costs: Storing pre-generated ZIP files for every possible file combination is expensive and inefficient
  2. Protection Needs: You want to add watermark text files or licensing information to each download
  3. Large File Sizes: Collections often exceed several gigabytes
  4. Dynamic Content: File sets change frequently, making pre-generated archives obsolete quickly

Traditional solutions require you to:

  • Generate and store ZIP files in advance (expensive storage)
  • Or buffer entire files in memory before sending (high memory usage, slow start times)
  • Maintain separate copies with different watermarks for different users

The ZipStream Solution

ZipStream allows you to dynamically create ZIP archives on-the-fly without storing them or buffering the entire content in memory. Here’s how it solves the watermark use case:

Architecture

Client Request → ZipStream API → Stream Multiple URLs + Watermark → ZIP Download

Implementation Example

curl -X POST https://zipstream.app/api/downloads \
  -H "Content-Type: application/json" \
  -d '{
    "suggestedFilename": "client-assets-2024.zip",
    "files": [
      {
        "url": "https://cdn.example.com/designs/logo-v1.psd",
        "zipPath": "designs/logo-v1.psd"
      },
      {
        "url": "https://cdn.example.com/designs/banner.ai",
        "zipPath": "designs/banner.ai"
      },
      {
        "url": "https://cdn.example.com/photos/product-001.jpg",
        "zipPath": "photos/product-001.jpg"
      },
      {
        "url": "https://yourserver.com/watermarks/client-123-license.txt",
        "zipPath": "LICENSE.txt"
      },
      {
        "url": "https://yourserver.com/watermarks/client-123-terms.pdf",
        "zipPath": "TERMS_OF_USE.pdf"
      }
    ],
    "compression": "STORE"
  }' \
  --output client-assets.zip

Key Benefits

1. Zero Storage Overhead

  • No need to pre-generate or store ZIP files
  • Files are streamed directly from your CDN or storage
  • Watermark files are generated dynamically per client

2. Memory Efficient

  • Files are streamed, not buffered
  • Can handle multi-gigabyte archives without memory issues
  • Server resource usage remains constant regardless of archive size

3. Dynamic Watermarking

Each client gets personalized watermark files:

// Generate client-specific watermark on your server
app.get('/watermarks/:clientId-license.txt', (req, res) => {
  const { clientId } = req.params;
  const client = getClientInfo(clientId);

  const watermark = `
This content is licensed to: ${client.company}
License ID: ${client.licenseId}
Valid until: ${client.expiryDate}
Authorized user: ${client.email}

This material is protected by copyright law.
Unauthorized distribution is prohibited.
  `;

  res.type('text/plain').send(watermark);
});

4. Cost-Effective at Scale

  • Storage savings: No duplicate ZIP files
  • Bandwidth optimization: Use compression: "STORE" for already-compressed files (PSDs, JPGs, PDFs)
  • CPU efficiency: No compression overhead for binary files

Real-World Example

Scenario: Photography studio with 10,000 clients, each downloading custom collections

Traditional Approach: - Average collection: 2GB (50 photos + watermarks) - Pre-generated ZIPs: 10,000 × 2GB = 20TB storage - Cost: ~$400/month on S3 Standard

ZipStream Approach: - Store original photos once: 100GB - Generate watermarks on-demand: <1MB - Total storage: 100GB - Cost: ~$2.30/month on S3 Standard - Savings: $397.70/month (99.4% reduction)

Advanced Features

File Validation Before Download

# Validate all files are accessible before starting download
curl -X POST "https://zipstream.app/api/downloads?validate=true" \
  -H "Content-Type: application/json" \
  -d '{"files": [...]}'

This prevents incomplete downloads if any source file is inaccessible.

Size Estimation

# Check total size before initiating download
curl -X POST https://zipstream.app/api/size-estimates \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {"url": "https://cdn.example.com/large-file.psd", "zipPath": "file.psd"}
    ]
  }'

Response:

{
  "estimatedTotalSize": 2147483648,
  "formattedSize": "2.0 GB",
  "files": 25
}

For secure, expiring download links:

# Create a 60-second temporary link
curl -X POST https://zipstream.app/api/download-links \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {"url": "https://cdn.example.com/file.jpg", "zipPath": "file.jpg"},
      {"url": "https://yourserver.com/watermark.txt", "zipPath": "LICENSE.txt"}
    ]
  }'

Response:

{
  "status": "ok",
  "linkId": "550e8400-e29b-41d4-a716-446655440000",
  "downloadUrl": "/api/download-links/550e8400-e29b-41d4-a716-446655440000",
  "expiresIn": 60
}

Best Practices

  1. Use STORE compression for media files: Photos, videos, PSDs are already compressed. Re-compressing wastes CPU.
  2. Host watermarks on fast servers: Keep watermark files on your application server for quick access
  3. Validate before large downloads: Use ?validate=true for collections over 1GB
  4. Rate limiting awareness: Default limit is 10 requests/hour per IP. Plan accordingly for high-traffic scenarios.
  5. CDN integration: Serve source files from a CDN for best performance

Technical Specifications

Feature Limit
Max files per archive 50 files
Max total size 5GB
Rate limit 10 requests/hour per IP
Burst limit 5 requests per 10 minutes
Link expiration 60 seconds (temporary links)

Security Considerations

  1. Access Control: Keep your watermark URLs private or implement authentication
  2. HTTPS Only: Always use HTTPS for source URLs to prevent interception
  3. Temporary Links: Use download links API for time-limited access
  4. Rate Limiting: Built-in rate limiting prevents abuse

Conclusion

ZipStream transforms the economics of large file distribution with watermark protection. By eliminating storage overhead and enabling dynamic watermarking, you can:

  • Save 99%+ on storage costs for archive files
  • Personalize every download without pre-generation
  • Scale effortlessly to millions of unique combinations
  • Deliver instantly without buffering delays

Whether you’re running a digital asset platform, photography studio, or design marketplace, ZipStream provides the infrastructure to deliver protected content efficiently and economically.


Ready to try it? Visit zipstream.app to start building dynamic ZIP archives today.

Back to All Articles

Ready to get started?

Try ZipStream and start building scalable file delivery infrastructure.