3 releases
0.1.2 | Jan 18, 2025 |
---|---|
0.1.1 | Jan 18, 2025 |
0.1.0 | Jan 18, 2025 |
#1109 in Filesystem
332 downloads per month
54KB
1K
SLoC
VueFinder Rust
Rust serverside implementation for VueFinder. Frontend: https://github.com/n1crack/vuefinder
Installation
As a Binary
Install the standalone server using cargo:
cargo install vuefinder
As a Library
Add to your project's Cargo.toml
:
[dependencies]
vuefinder = "*"
Or using cargo add:
cargo add vuefinder
Usage
There are three ways to use VueFinder:
1. As a Standalone Binary
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
2. As a Library with Router
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
}
3. As a Library with Custom Implementation
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?;
Configuration
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"
}
}
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]-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
Features
- File operations: upload, download, delete, rename, move
- Directory operations: create, list, delete
- Archive operations: zip, unzip
- Multiple storage adapters support
- Large file support (up to 100MB by default)
- Configurable API endpoints and limits
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~23–36MB
~603K SLoC