The filesystem module provides a unified abstraction layer for Project Forge applications to interact with different storage backends. It enables applications to work seamlessly with local disk storage, in-memory filesystems, and remote storage systems through a consistent API.
Overview
This module provides:
Unified Interface: Single FileLoader interface for all filesystem operations
Multiple Backends: Support for disk-based and memory-based storage
File Operations: Complete CRUD operations for files and directories
Advanced Features: Recursive operations, file watching, compression, and downloads
Performance: Efficient operations with streaming support for large files
Key Features
Storage Backends
Disk Storage: Traditional filesystem operations using afero.OsFs
Memory Storage: In-memory filesystem for testing and temporary data using afero.MemMapFs
Read-Only Mode: Configurable read-only access for security
Cross-Platform: Automatic backend selection based on platform (JS uses memory)
File Operations
File reading, writing, and streaming
Directory creation and traversal
File copying and moving
Recursive operations with ignore patterns
JSON file handling with type safety
File compression and extraction
Advanced Capabilities
Remote Downloads: HTTP/HTTPS file downloads with progress tracking
Archive Support: ZIP file extraction and creation
Tree Structures: Generate file tree representations
Pattern Matching: File filtering with glob patterns
Metadata Access: File permissions, sizes, and modification times
Package Structure
Core Interface
FileLoader - Primary interface for all filesystem operations