ObjDocumentFile handles file-level operations for documents, providing low-level file management, storage, and retrieval functionality.
Module: factory.core/ObjDocumentFile.py
Inherits from: ObjDocument.ObjDocument
from ObjDocumentFile import ObjDocumentFile
# Create instance
doc_file = ObjDocumentFile()
# Save file
doc_file.save_file(
content=binary_data,
filename="report.pdf",
metadata={"type": "report", "size": len(binary_data)}
)
# Read file
content = doc_file.read_file("report.pdf")
# Get file info
info = doc_file.get_file_info("report.pdf")
print(f"Size: {info['size']}, Modified: {info['modified']}")
# Delete file
doc_file.delete_file("report.pdf")
# Check file exists
if doc_file.file_exists("report.pdf"):
print("File found")
# Validate file type
is_valid = doc_file.validate_file_type(
filename="report.pdf",
allowed_types=["pdf", "docx"]
)
# Calculate checksum
checksum = doc_file.calculate_checksum("report.pdf")
ObjDocument.py - Higher-level document operationsObjDocumentStore.py - Document storage backendUses stdlib zipfile for compression — no encryption needed.
No Windows compatibility issues (pure Python).