| Crates.io | vuefinder |
| lib.rs | vuefinder |
| version | 0.1.2 |
| created_at | 2025-01-18 14:33:19.391856+00 |
| updated_at | 2025-01-18 16:06:44.534662+00 |
| description | A Rust implementation of VueFinder file manager |
| homepage | |
| repository | https://github.com/boenfu/vuefinder |
| max_upload_size | |
| id | 1521679 |
| size | 109,736 |
Rust serverside implementation for VueFinder. Frontend: https://github.com/n1crack/vuefinder
Install the standalone server using cargo:
cargo install vuefinder
Add to your project's Cargo.toml:
[dependencies]
vuefinder = "*"
Or using cargo add:
cargo add vuefinder
There are three ways to use VueFinder:
Install and run VueFinder as a standalone server:
# Development
cargo run
cargo run -- --port 3000
cargo run -- --host 0.0.0.0 --port 3000
# Production
vuefinder
vuefinder --port 3000
vuefinder --host 0.0.0.0 --port 3000
The server will start at http://localhost:8080 by default. You can customize using command line options:
-p, --port <PORT>: Specify server port [default: 8080]-b, --host <HOST>: Specify binding address [default: 127.0.0.1]-l, --local-storage <PATH>: Specify local storage path [default: ./storage]# Examples
vuefinder --local-storage /path/to/storage
vuefinder --host 0.0.0.0 --port 3000 --local-storage /data/files
Integrate VueFinder into your existing Actix-Web application:
use actix_web::{App, HttpServer};
use std::collections::HashMap;
use std::sync::Arc;
use vuefinder::{
app_config::{VueFinderAppConfig, VueFinderAppExt},
finder::VueFinderConfig,
storages::{local::LocalStorage, StorageAdapter},
};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// Configure VueFinder
let app_config = VueFinderAppConfig {
api_path: "/custom/api".to_string(), // Optional: customize API path
json_limit: 50 * 1024 * 1024, // Optional: 50MB limit
storages: LocalStorage::setup("./storage"),
finder_config: Arc::new(VueFinderConfig::default()),
..VueFinderAppConfig::default()
};
// Start server
HttpServer::new(move || {
App::new()
.configure_vuefinder(app_config.clone())
})
.bind("127.0.0.1:8080")?
.run()
.await
}
Use VueFinder's components to build your own file management system:
use vuefinder::{VueFinder, VueFinderConfig, StorageAdapter};
// Create your own storage adapter
struct CustomStorage;
#[async_trait]
impl StorageAdapter for CustomStorage {
// Implement required methods
}
// Create VueFinder instance with custom storage
let mut storages = HashMap::new();
storages.insert("custom".to_string(), Arc::new(CustomStorage));
let vue_finder = VueFinder {
storages: Arc::new(storages),
config: Arc::new(VueFinderConfig::default()),
};
// Use VueFinder methods directly
vue_finder.list_contents("path/to/dir").await?;
VueFinder supports configuration through a JSON file. By default, it looks for vuefinder.json in the current directory.
You can specify a custom config file path using the -c or --config option:
vuefinder --config /path/to/config.json
Example configuration file:
{
"public_links": {
"local://downloads": "https://vuefinder-rust.com/downloads"
}
}
-p, --port <PORT>: Specify server port [default: 8080]-b, --host <HOST>: Specify binding address [default: 127.0.0.1]-l, --local-storage <PATH>: Specify local storage path [default: ./storage]-c, --config <PATH>: Specify configuration file path [default: ./vuefinder.json]# Examples
vuefinder --local-storage /path/to/storage --config /path/to/config.json
vuefinder --host 0.0.0.0 --port 3000 --config custom-config.json
This project is licensed under the MIT License - see the LICENSE file for details.