Multi-cloud storage manager with automatic fallback for Git LFS (Cloudinary + Google Drive)
Project description
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.
โจ 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:
- Tries primary storage first (Cloudinary or Google Drive)
- If full โ automatically uploads to secondary storage
- 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
- Sign up at cloudinary.com (free tier: 25GB)
- Get your credentials from the dashboard
- Run:
flash setup
Google Drive Setup
- Go to Google Cloud Console
- Create a project and enable Google Drive API
- Create OAuth 2.0 Client ID (Desktop app)
- Run:
flash setup-gdrive - 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.
๐ Links
๐ Credits
Built with:
Made with โก by the Flash Storage team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flash_storage-0.3.0.tar.gz.
File metadata
- Download URL: flash_storage-0.3.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4323e036730a07281a016f2442fb5399a40ee3fdf7e82b77265282e9515f9e2f
|
|
| MD5 |
27f15f304b0cd40aab5ac0fd6f6cdbd1
|
|
| BLAKE2b-256 |
3736162ec18070b57b56600003f2ae375af44c706b4ce3651504ebdbc3a65791
|
File details
Details for the file flash_storage-0.3.0-py3-none-any.whl.
File metadata
- Download URL: flash_storage-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a84fdb09a7fff8a17195bb3fad3eda1e953926f1f4c2d26157340d2fb458fdd9
|
|
| MD5 |
9ce35b112cf1cff7769678f5f64ba535
|
|
| BLAKE2b-256 |
021c8bb32d82246caa4041db90b7541a6bdf953ba991216adac71233af6de7fd
|