Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arielhorwitz/geckopanda
Save and load files from local disk, Google Drive, or Amazon S3.
https://github.com/arielhorwitz/geckopanda
Last synced: about 2 months ago
JSON representation
Save and load files from local disk, Google Drive, or Amazon S3.
- Host: GitHub
- URL: https://github.com/arielhorwitz/geckopanda
- Owner: ArielHorwitz
- License: unlicense
- Created: 2023-08-26T07:47:00.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-02-01T14:01:47.000Z (11 months ago)
- Last Synced: 2024-10-27T08:03:42.960Z (about 2 months ago)
- Language: Rust
- Homepage: https://docs.rs/geckopanda/
- Size: 129 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Crate](https://img.shields.io/badge/crates.io-v0.2.0-cc5500?style=for-the-badge)](https://crates.io/crates/geckopanda)
[![Docs](https://img.shields.io/badge/Docs-116611?style=for-the-badge&logo=docs.rs)](https://docs.rs/geckopanda/0.2.0/geckopanda)
[![License](https://img.shields.io/badge/Unlicense-blue?style=for-the-badge&logo=unlicense&logoColor=white)](https://unlicense.org)# GeckoPanda
Save and load files from local disk, Google Drive, or Amazon S3.
- ❌ Fast
- ❌ Smart
- ✅ SimpleThis crate provides the `Storage` trait and several backends that implement it,
providing a very simple API for listing, creating, updating, and deleting files.
These operations can be done either asynchronously or syncronously (blocking).## Usage
```rust
use geckopanda::prelude::*;fn main() -> Result<(), Box> {
let storage = LocalDiskStorage::new("./storagecache")?;
// See examples for `GoogleDriveStorage` and `AmazonS3Storage`let file_id = storage.create_blocking("example.file")?;
println!("Created file ID: {file_id}");let data = "example file content";
storage.update_blocking(&file_id, data.as_bytes())?;
println!("Uploaded data: {data:?}");let download_data = String::from_utf8(storage.get_blocking(&file_id)?)?;
assert_eq!(data, &download_data);
println!("Downloaded data: {download_data:?}");let total_size: u64 = storage
.list_blocking()?
.iter()
.map(|metadata| metadata.size)
.sum();
println!("Total size: {total_size} bytes");storage.delete_blocking(&file_id)?;
println!("Deleted file ID: {file_id}");
Ok(())
}
```