lan_web_server 1.0.0
lan_web_server: ^1.0.0 copied to clipboard
A cross-platform Flutter/Dart LAN file sharing server. Easily upload, download, delete, and browse files or folders via a beautiful web interface. Works on desktop, mobile, and embedded devices, makin [...]
中文文档 (Chinese README)
lan_web_server #
A cross-platform Flutter/Dart LAN file sharing server. Easily upload, download, delete, and browse files or folders via a beautiful web interface. Works on desktop, mobile, and embedded devices, making local file access and management simple and efficient.
Features #
- 📁 File/Folder Upload: Supports multiple files and nested directories
- 📥 File/Folder Download: Large files and folders are zipped and streamed for efficient download
- 🗑️ File/Folder Deletion: Easily remove content from the shared directory
- 🖥️ Cross-Platform: Runs on Windows, macOS, Linux, Android, and iOS
- 🌐 User-Friendly Web UI: Modern web interface with drag-and-drop upload and file browsing
- 🔒 Security: Path validation prevents directory traversal; LAN-only by default
- 🚀 High Performance: Streams large files/folders, minimizing memory usage
- 📝 Logging & State Streams: Easy integration into Flutter apps
Quick Start #
1. Install Dependencies #
In the project root:
flutter pub get
2. Run the Example (Desktop/Mobile) #
cd example
flutter run
3. Integrate into Your Dart/Flutter Project #
import 'package:web_server/web_server.dart';
final server = WebServerService(port: 8080, sharedDir: '/your/shared/dir');
await server.start();
4. Access the Web UI #
Open your browser and visit:
http://<your-local-ip>:8080/
API Endpoints #
| Path | Method | Description |
|---|---|---|
/ |
GET | Home page (Web UI) |
/files |
GET | List files/folders |
/upload |
POST | Upload files/folders |
/download |
GET | Download files/folders |
/delete |
POST | Delete files/folders |
/static-path |
GET | Direct access to shared files |
- Folder download: Automatically zipped and streamed, supports large directories
- Large file download: Streamed to minimize memory usage
Typical Use Cases #
- File transfer between devices on the same LAN
- Temporary file sharing between mobile and desktop
- Cross-platform local file management
- Lightweight file server for intranet environments
FAQ #
-
Q: How do I change the shared directory?
A: Specify thesharedDirparameter when creatingWebServerService. -
Q: Does it support concurrent users?
A: Yes, it uses Dart async IO and is suitable for lightweight concurrent scenarios. -
Q: Will large files or directories cause memory issues?
A: No, streaming and temporary file strategies keep memory usage low. -
Q: How to use on mobile?
A: See theexampledirectory. On mobile, the app uses the application documents directory as the shared folder.
Contributing & Feedback #
Issues, PRs, and suggestions are welcome!
For custom features, bug reports, or ideas, please contact the author or submit to GitHub Issues.