Why 3D CAD and Outlook .PST Parsing Belong Inside Browser Web Workers (Zero-Upload Architecture)

2026-11-28来源 dev.toEnglish

TL;DR: Modern web file converters face a privacy and compute dilemma on formats like Outlook .pst/.ost personal folders and ISO-10303-21 .step/.iges 3D CAD assemblies. Uploading a 90 MB company mailbox or proprietary STEP model to a shared server adds network latency, disk exposure, and heavy native dependencies. In Wave 4 of KaijuConverter's 223+ format file engineering platform, we split execution cleanly: .mbox, .xapk/.apk/.crx/.jar/.rar, and .hwpx run across 19 isolated EU server engines, while .pst/.ost (pst-worker.js) and .step/.iges (cad-worker.js) execute strictly client-side in Web Workers with 0 bytes uploaded and an explicit HTTP 422 fail-closed guard on server REST/MCP endpoints.

The Binary Boundary Problem in Multi-Format Engineering

When a user drops a corporate Outlook archive or an engineering CAD assembly into an online converter, two things break the classic "upload -> convert -> download" model:

  1. Privacy surface: .pst and .ost files often contain years of confidential correspondence. Even with TLS 1.3 transport and short server retention (e.g., 30-minute upload TTL), eliminating the network transfer entirely is strictly stronger.
  2. Binary dependency weight: Native readpst or full desktop CAD kernels (OpenCASCADE) are heavy, memory-hungry binaries that do not belong on latency-sensitive web nodes.

By running a WebAssembly / pure-JS worker inside a dedicated browser thread (Worker), the browser becomes the sandbox: up to 100 MB can be parsed locally with zero server quota consumed and zero bytes crossing the wire.

Hybrid Execution Matrix (19 Server Engines + 2 Browser Web Workers)

Format Group Execution Mode Driver / Worker Verified Targets Hard Constraints & Fail-Closed Rules
.mbox Isolated EU Server OutlookMailDriver .eml, .zip, .pdf, .html, .txt RFC 4155 From parser capped at 500 messages
.xapk, .apk, .crx, .jar, .rar Isolated EU Server ArchiveDriver .apk, .zip, .7z, .tar manifest.json split-APK resolution, Cr24 CRX2/CRX3 strip, encrypted entries fail closed
.hwpx Isolated EU Server HwpxDriver .pdf, .docx, .odt, .html, .txt KS X 6101 OWPML (283.465 units/mm), 5 MB / 50 pages / 60s cap
.pst / .ost Browser Web Worker pst-worker.js .eml, .zip, .pdf !BDN magic, ANSI wVer 14–15 & Unicode wVer 23 (XBLOCK/SLBLOCK); fails closed on Cyclic 0x02 & OST 2013+ (wVer >= 36); HTTP 422 on REST
.step / .stp / .iges / .igs Browser Web Worker cad-worker.js .stl, .obj Self-hosted OpenCASCADE WASM (occt-import-js), linearDeflection: 0.001; HTTP 422 on REST

Deep Dive 1: Parsing .PST / .OST Mailboxes Without Server Uploads

The Microsoft Personal Storage Table (.pst) binary format begins with the 4-byte !BDN magic signature (0x21 0x42 0x44 0x4E). Rather than uploading multi-megabyte mail stores, pst-worker.js reads local File slices directly in browser memory:

  • Supported revisions: ANSI (wVer 14–15) and Unicode (wVer 23), handling unencrypted (bCryptMethod = 0x00), Permute-obfuscated (0x01 via PERMUTE_DECODE), and multi-block XBLOCK/SLBLOCK data trees up to 500 IPM.Note messages.
  • Explicit fail-closed boundaries: High-encryption Cyclic (0x02), password-locked stores, and OST 2013+ (wVer >= 36) fail closed with a deterministic error instead of silently returning corrupt .eml payloads.
  • Server defense-in-depth: If an automated client sends a .pst or .ost file to /convert, /api/v1/jobs, or /api/mcp/upload, the controller rejects it before touching disk or creating a database row with HTTP 422, directing the caller to the browser Workbench.

Deep Dive 2: Triangulating .STEP and .IGES CAD Assemblies via OpenCASCADE WASM

Industrial B-rep CAD interchange formats—ISO 10303-21 STEP (AP203, AP214, AP242) per ISO 10303 and IGES 5.x 80-column (S/G/D/P/T) records—describe exact parametric NURBS surfaces rather than triangle meshes.

Using self-hosted OpenCASCADE Technology (OCCT) compiled to WebAssembly (occt-import-js), cad-worker.js triangulates assemblies directly in the user's browser:

  • Tessellation tolerances: linearUnit: 'millimeter', linearDeflection: 0.001, angularDeflection: 0.5.
  • Verified mesh exports:
    • Binary STL: strict 84 + 50 × triangles byte layout ready for 3D slicing.
    • ASCII Wavefront OBJ: clean vertex (v) and face (f) geometry.

For traditional container extraction like KaijuConverter's RAR-to-ZIP archive converter or extracting split Android .xapk bundles, isolated EU server drivers (7-Zip 23.01 + PHP ZIP integrity checks) remain faster and preserve a 30/60-minute ephemeral purge SLA.

Deep Dive 3: Deterministic HTTP 422 Fail-Closed Guard in REST and MCP

A browser-only architecture is only trustworthy if server endpoints refuse to accept restricted formats before writing a single byte to disk or inserting a database row. In KaijuConverter, UploadController, JobController, and McpController share a pre-flight extension check (browserOnlyWebWorkerMessage) covering .pst, .ost, .step, .stp, .iges, and .igs.

When an automated client attempts to upload a .pst mailbox or a .step CAD assembly via multipart upload (POST /api/mcp/upload) or inline JSON-RPC (POST /api/mcp), the server aborts immediately before writing to disk:

{ "jsonrpc": "2.0", "id": 42, "result": { "isError": true, "content": [ { "type": "text", "text": "KaijuConverter error: STEP/IGES 3D CAD triangulation runs locally inside your browser Web Worker (zero upload). Drop the file in the Workbench to export .STL or .OBJ." } ] } } 

At the stdio CLI boundary (npx -y https://kaijuconverter.com/downloads/kaijuconverter-mcp.tgz), kaijuconverter-mcp.js also inspects the file extension locally before opening an HTTP multipart stream to /api/mcp/upload, failing closed in milliseconds with exit code 1 and leaving zero temporary files on the remote server.

Deep Dive 4: Server-Side Drivers (.MBOX, .XAPK/.CRX, .HWPX)

On the server side, three specialized PHP and CLI drivers handle untrusted binary containers:

  • OutlookMailDriver (.mbox): Parses RFC 4155 From mbox delimiters incrementally, extracts MIME headers and inline attachments, and caps batch exports at 500 messages to prevent memory exhaustion.
  • ArchiveDriver (.xapk, .apk, .crx, .jar, .rar): Strips Chrome Extension Cr24 binary headers (CRX2 16-byte header and CRX3 protobuf header) to recover clean .zip payloads, resolves manifest.json split-APK entries inside .xapk bundles, and rejects password-encrypted archives cleanly.
  • HwpxDriver (.hwpx): Parses KS X 6101 OWPML XML (283.465 HWPUNIT per millimeter), converting Korean Hangul XML sections into .pdf, .docx, .odt, .html, or .txt under deterministic 5 MB / 50 pages / 60s execution bounds.

Summary for Architects & MCP Integrators

Hybrid client/server routing lets a single file-engineering platform support 223+ formats and 3,291+ pairs across 12 languages without sacrificing either server security or user privacy. For full endpoint schemas, inspect the live OpenAPI 3.1 specification (/.well-known/openapi.json) and MCP server manifest (/.well-known/mcp.json).

原文:https://www.a8q9.cn/en/article/why-3d-cad-and-outlook-pst-parsing-belong-inside-browser-web-workers-zero-upload-bca3d3.html

相关文章