@better-files/plugin-processing
v0.1.0
Published
Document processing for Better Files: Office to PDF (LibreOffice or your converter) so every format can be viewed and watermarked, plus thumbnails
Maintainers
Readme
@better-files/plugin-processing
Document processing for Better Files. Office and other formats get a PDF rendition, so the secure viewer and watermarked downloads work for Word, Excel and PowerPoint. Every document gets a thumbnail.
import { processingPlugin, libreOffice } from 'better-files/plugin-processing';
processingPlugin({ converters: [libreOffice()] }); // needs `soffice` (LibreOffice) on the server- Runs after
document.uploaded,version.created,version.restoredandversion.scanned. Quarantined files wait for a clean scan. Failures are retried bydr.maintain()(three attempts);processing.reprocessruns it again. - Renditions (
pdf,thumbnail) are stored through core's rendition store: encrypted like the file and deleted with it. The viewer and watermark plugins pick up the PDF rendition automatically; a watermarked download of a.docxis a stamped.pdf. processing.thumbnails({ roomId, nodeIds })returns data URLs for listings, only for documents the caller may view.processing.status({ nodeId })reportspending,done,skippedorfailed.libreOffice({ binary, timeoutMs })runssoffice --headlesswith a private profile per conversion, so conversions can run in parallel. Files are written to a temporary folder with a neutral name, then removed. AConverteris two methods (accepts,toPdf) if you use a conversion service instead.mode: 'inline'waits for processing inside the upload request (scripts, tests); the default runs it in the background.
unpdf and @napi-rs/canvas (thumbnails) are optional peer dependencies.
Part of Better Files.
