Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Adds seamless HEIC/HEIF format support to HTTP File Server version 3 (HFS 3) with server-side conversion to JPG for preview and thumbnails

License

Notifications You must be signed in to change notification settings

pavelnil/HFS-HEIC-Support

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HFS-HEIC-Support Plugin for HTTP File Server


Description

HFS-HEIC-Support is a plugin for HTTP File Server version 3 (HFS 3) that provides support for HEIC/HEIF formats. The plugin performs server-side conversion of images to JPG format "on the fly" with intelligent caching, enabling seamless preview through the standard Show function in HFS and thumbnail generation. Perfect for comfortable, ultra-fast browsing with instant flipping through massive HEIC/HEIF file collections.


Key Features

Complete HEIC/HEIF Support

  • Automatic detection of HEIC/HEIF files in the HFS file system
  • Seamless conversion to JPG for compatibility with all browsers
  • File viewing through standard HFS Show viewer

Intelligent Caching System

  • Two-level caching - in memory and on disk
  • Cache validation when source files are modified
  • Automatic cleanup of expired cache files (TTL configurable: 1 minute - 30 days)
  • Pre-conversion of neighboring files for faster navigation
  • Thumbnail cache with validity checking

Flexible Configuration

  • Configurable JPEG quality (10-100%)
  • Pre-conversion control - number of previous/next files (0-100). 0 disables pre-conversion, leaving only immediate conversion of the current file
  • Parallel processing - up to 8 background workers (1-8)
  • Integration with Sharp for 256px thumbnail generation

Performance Optimization

  • Load balancing between immediate and background workers:
    • Priority processing - immediate conversion of requested files
    • Background pre-conversion - parallel processing of neighboring files
    • Pre-conversion queue for neighboring files is built first for N next files, then for N previous files relative to current file, ensuring fast priority forward browsing
  • Minimal blocking of the main HFS thread - all conversions are executed in the workers.
  • Automatic worker restart when settings change

Reliability and Monitoring

  • Worker isolation - processing in separate threads
  • Error handling - detailed logging of conversion issues
  • Graceful shutdown - proper termination during plugin unload including worker cleanup

Technical Implementation

Architecture

  • Backend: Node.js using worker_threads for multi-threaded processing
  • Conversion: heic-convert library based on libheif
  • Thumbnails via Sharp plugin for HFS
  • Visualization: Integration with HFS frontend API for icon display and viewer
  • Caching: Two-level system (memory + filesystem) with TTL
  • MD5 hashing for file identification in cache

System Dependencies

  • libheif - HEIC/HEIF conversion library (included in plugin)
  • libde265 - HEVC decoder (included in plugin)
  • Node.js modules: heic-convert, heic-decode, jpeg-js, libheif-js, pngjs (included in plugin)
  • Sharp plugin for HFS (installed separately)

Performance

  • Memory consumption:

    • ~150MB per worker in active mode (up to 250MB peak with JPG quality 50);
    • ~100MB per worker in passive mode after conversion;
    • ~0-20MB per worker after worker restart during hourly interval cleanup.
  • Recommendation: Number of workers = number of logical CPUs for maximum pre-conversion speed. Corresponds to 100% CPU load. Provides pre-conversion of over 100 files per minute on 8 logical CPUs

  • Optimization: Automatic cache cleanup by TTL every hour + worker restart

Security in Accordance with HFS

  • Protection against path traversal and injections
  • MIME type and extension validation
  • Local processing - conversion performed only on server
  • Worker isolation - processing in separate threads

Installation

  1. Copy the plugin folder to the \plugins directory of your HFS
  2. Activate the plugin through the HFS web interface
  3. Configure parameters in the Options section

Plugin Settings

screenshot1

Usage

  1. Open the context menu for a file with .heic or .heif extension in HFS
  2. Click Show to view - the plugin will automatically perform conversion
  3. Subsequent views use the cached version
  • Single click on HEIC icon → opens in Show viewer similar to Instant-show plugin
  • Support for Auto-play in Show

Thumbnails

  • Auto-generation of 256px thumbnails (if enabled)
  • Thumbnail caching for fast display in lists
  • Page refresh required to display thumbnails after generation
  • Thumbnails are generated only for files that have successfully undergone conversion/pre-conversion, not for the entire file list in the interface

Requirements

  • Server: HFS API version 12.6+
  • Sharp plugin: Recommended for thumbnail generation (optional)
  • Memory: Minimum additional 512MB free RAM for worker operation
  • Disk: 1GB for cache files (depends on number of HEIC files)

Limitations

  • For now Windows and Linux only - plugin uses native libheif/libde265 DLL/so libraries. (macOS support could be achieved by adding libheif and libde265 dylib for macOS to bin)
  • Memory consumption - each worker requires ~150MB RAM with JPG quality 50. With JPG quality 100 and 8 workers, consumption can reach 6GB during active pre-conversion
  • High CPU load during pre-conversion with large number of workers
  • JPEG quality - changes require plugin restart
  • File list sorting for pre-conversion queue is performed by name only
  • Large collections - TTL configuration recommended for disk space management

Use Cases

  • Image archives - working with large HEIC collections without pre-conversion
  • Shared access - providing access to HEIC files for users without format support
  • Traffic optimization - conversion to JPEG for bandwidth savings
  • Mobile backups - organizing access to iPhone/iPad photo archives
  • Corporate media libraries - unified access to HEIC content for employees
  • Photographers - viewing HEIC shots through web interface

Support:

  • BTC: bc1qeuq7s8w0x7ma59mwd4gtj7e9rjl2g9xqvxdsl6
  • TON: UQAOQXGtTi_aM1u54aQjb8QiXZkQdaL9MDSky5LHN0F5-yF2

About

Adds seamless HEIC/HEIF format support to HTTP File Server version 3 (HFS 3) with server-side conversion to JPG for preview and thumbnails

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published