Skip to main content

Flash Storage

Multi-cloud storage manager with automatic fallback for Git LFS

Store your large files in Cloudinary or Google Drive with intelligent automatic fallback. Perfect for Git LFS workflows, backups, and managing binary assets.

PyPI version Python 3.8+ License: MIT

✨ Features

  • 🌩️ Dual Cloud Support: Cloudinary + Google Drive
  • 🔄 Automatic Fallback: Seamlessly switches when storage is full
  • 🎯 Smart Primary Storage: Choose your preferred cloud, auto-fallback to the other
  • 🚀 Simple API: Clean Python library and CLI
  • 🔒 Secure: OAuth 2.0 for Google Drive, secure credential storage
  • 📦 Git LFS Ready: Works as a custom transfer agent
  • 🆓 Free Tiers: Cloudinary (25GB) + Google Drive (15GB)

🚀 Quick Start

Installation

pip install flash-storage

Setup

# Configure Cloudinary
flash setup

# Configure Google Drive (optional, for fallback)
flash setup-gdrive

# Set your primary storage
flash set-primary cloudinary  # or 'gdrive'

Basic Usage

# Upload a file (automatic fallback if primary is full)
flash push myfile.psd

# Download it back
flash pull myfile.psd

# Check status
flash status

📚 Usage

Command Line

# Upload files
flash push design.sketch
flash push video.mp4 -m "Add new video"

# Download files
flash pull design.sketch

# Switch primary storage
flash set-primary gdrive

# Check configuration
flash status

Python Library

from flash_storage import flash as fs

# Setup (one-time)
fs.setup("cloud-name", "api-key", "api-secret")

# Upload
result = fs.push("myfile.psd")
print(f"Uploaded to: {result['storage']}")  # 'cloudinary' or 'gdrive'
print(f"URL: {result['url']}")

# Download
fs.pull("myfile.psd")

# Check if exists
if fs.exists("myfile.psd"):
    print("File is in cloud storage!")

# Get file info
info = fs.info("myfile.psd")
print(f"Storage: {info['storage_location']}")
print(f"Size: {info['size']} bytes")

🎯 How It Works

Smart Storage Selection:

  1. Tries primary storage first (Cloudinary or Google Drive)
  2. If full → automatically uploads to secondary storage
  3. On next upload → tries primary again (in case you freed up space)

Example Flow:

Primary: Cloudinary, Fallback: Google Drive

Upload 1 → Cloudinary ✓
Upload 2 → Cloudinary ✓
Upload 3 → Cloudinary FULL → Google Drive ✓ (automatic)
Upload 4 → Tries Cloudinary again → Still full → Google Drive ✓
[You delete files from Cloudinary]
Upload 5 → Cloudinary ✓ (back to primary automatically)

🔧 Configuration

Cloudinary Setup

  1. Sign up at cloudinary.com (free tier: 25GB)
  2. Get your credentials from the dashboard
  3. Run: flash setup

Google Drive Setup

  1. Go to Google Cloud Console
  2. Create a project and enable Google Drive API
  3. Create OAuth 2.0 Client ID (Desktop app)
  4. Run: flash setup-gdrive
  5. First upload will open browser for OAuth authorization

Storage Priority

# Set Cloudinary as primary (default)
flash set-primary cloudinary

# Set Google Drive as primary
flash set-primary gdrive

Configuration is stored in ~/.flash-storage/

📖 Advanced Usage

Batch Upload Script

from pathlib import Path
from flash_storage import flash as fs

# Upload all PSD files
for file in Path("designs").glob("*.psd"):
    result = fs.push(str(file))
    print(f"✓ {file.name} → {result['storage']}")

Conditional Storage

from flash_storage.config import CloudinaryConfig

config = CloudinaryConfig()

# Large files → Google Drive
file_size = Path("video.mp4").stat().st_size
if file_size > 100 * 1024 * 1024:  # > 100MB
    config.set_primary_storage('gdrive')

# Upload (will use Google Drive as primary)
fs.upload("video.mp4")

Web API Integration

from flask import Flask, request
from flash_storage import flash as fs

@app.route('/upload', methods=['POST'])
def upload():
    file = request.files['file']
    file.save('/tmp/upload')

    result = fs.upload('/tmp/upload')
    return {
        'storage': result['storage'],
        'oid': result['oid'],
        'size': result['size']
    }

🔄 Git LFS Integration

Flash Storage can act as a Git LFS custom transfer agent:

# Initialize in your repo
flash init

# Track files with Git LFS
git lfs track "*.psd"
git lfs track "*.mp4"

# Files automatically upload to your configured storage
git add design.psd
git commit -m "Add design"
git push

💡 Use Cases

  • Design Teams: Store large Photoshop/Sketch files
  • Video Projects: Manage video files with Git
  • Data Science: Version control datasets and models
  • Game Development: Store game assets and builds
  • Backup Solution: Automatic cloud backup with fallback
  • Build Artifacts: Store compilation outputs

🆓 Free Storage Limits

Service Free Storage Free Bandwidth Notes
Cloudinary 25GB 25GB/month Plus image transformations
Google Drive 15GB Unlimited Shared with Gmail/Photos
Combined 40GB Great for small-medium projects

📋 Commands Reference

Command Description
flash setup Configure Cloudinary credentials
flash setup-gdrive Configure Google Drive OAuth
flash set-primary <storage> Set primary storage (cloudinary/gdrive)
flash push <file> Upload file to cloud storage
flash pull <file> Download file from cloud storage
flash upload <file> Upload without replacing local file
flash status Show configuration and storage status
flash init Initialize Git LFS integration

🛠️ Requirements

  • Python 3.8+
  • Git LFS (optional, for Git integration)
  • Cloudinary account (free tier available)
  • Google Cloud project (optional, for Google Drive)

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🙏 Credits

Built with:


Made with ⚡ by the Flash Storage team

Metadata

Release files for flash-storage 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flash-storage 0.3.0
File Size Uploaded Provenance
flash_storage-0.3.0.tar.gz 23.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for flash-storage 0.3.0
File Interpreter ABI Platform
flash_storage-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.3 kB

Release files / flash_storage-0.3.0.tar.gz

Download URL flash_storage-0.3.0.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4323e036730a07281a016f2442fb5399a40ee3fdf7e82b77265282e9515f9e2f
BLAKE2b-256 checksum
How to use checksums
3736162ec18070b57b56600003f2ae375af44c706b4ce3651504ebdbc3a65791
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / flash_storage-0.3.0-py3-none-any.whl

Download URL flash_storage-0.3.0-py3-none-any.whl
Size 24.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a84fdb09a7fff8a17195bb3fad3eda1e953926f1f4c2d26157340d2fb458fdd9
BLAKE2b-256 checksum
How to use checksums
021c8bb32d82246caa4041db90b7541a6bdf953ba991216adac71233af6de7fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Security for flash-storage 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page