-
Notifications
You must be signed in to change notification settings - Fork 1
worker Overview
GitHub Action edited this page Apr 21, 2026
·
2 revisions
A comprehensive toolkit for building and managing backend processing workers within the Quatrain ecosystem. It provides robust utilities for executing child processes, interacting with file systems, pushing remote events, and standardizing message handler execution.
In distributed architectures, workers are processes that consume events (via queues or CLI) and perform heavy background tasks (such as video rendering, file processing, or data synchronization).
The @quatrain/worker package abstracts away the boilerplate needed to instantiate a worker, connect it to a queue, and report its progress back to a central API.
-
Worker: The core class offering static methods to execute shell commands (execPromise), push webhook events (pushEvent), and standardize the message-handling loop (handler). -
FileSystem: A wrapper around Node.js filesystem operations, providing typed and safe methods for managing files, directories, and temporary processing paths. -
Helpers: A collection of utility functions to streamline worker tasks.
npm install @quatrain/worker
# or
yarn add @quatrain/worker-
Agnostic execution mode: A worker can run by listening to a queue (
queuemode) or locally via standard input (cliortestmode). -
Process Spawning: Safely wrap
child_process.spawninto Promises with structured logging. -
Event Reporting: Push HTTP patch events to a backend orchestrator using
axiosto update job statuses in real-time.
For concrete examples and usage guides, please refer to the How-To Guide.
AGPL-3.0-only