This directory contains the backend implementation for the LDOC Viewer application.
The backend provides:
The LDOCWriter
class handles the creation of LDOC containers:
The LDOCReader
class handles the extraction and inspection of LDOC containers:
The backend exposes the following API endpoints:
POST /api/encode
: Creates an LDOC container from uploaded filesPOST /api/info
: Returns metadata about an LDOC containerPOST /api/extract
: Extracts all files from an LDOC container as a ZIP archivePOST /api/view
: Returns a list of files in an LDOC container with metadataPOST /api/view/file
: Returns the content of a specific file from an LDOC containerThe backend includes helper functions for detecting file types:
isTextFile
: Determines if a file is a text file based on extension or MIME typeisImageFile
: Determines if a file is an image based on extension or MIME typeisViewableFile
: Determines if a file can be viewed in the browserThe LDOC format consists of:
Header (32 bytes):
Manifest:
File Data:
Trailer: