UNPKG

@codeplaydata/datasus

Version:

This application decompress the datasus micro data and serve as a gateway class.

30 lines (29 loc) 1.29 kB
import { Command } from "../Command.js"; import { JobMessage } from "./JobMessage.js"; import { Parser } from "../../interface/utils/Parser.js"; import { Records } from "../../core/Records.js"; /** * Responsible for forking and supervising a worker process (job script). * * It forwards messages to the child process and resolves when the child exits. * Optionally, it applies a parser and invokes a callback for each emitted record. */ export declare class JobRunner implements Command { private jobScript; /** * @param jobScript Absolute or relative path to the worker script to be forked. */ private constructor(); /** * Factory method for creating a JobRunner bound to a script. */ static init(jobScript: string): JobRunner; /** * Starts the child process and wires IPC events. * @param jobMsg Message sent to the child to start processing. * @param callback Optional callback invoked per record/message from the child. * @param parser Optional parser to transform each record before callback. * @param progressCallback Optional callback for progress updates from the child. */ exec(jobMsg: JobMessage, callback?: Function, parser?: Parser<Records>, progressCallback?: Function): Promise<unknown>; }