UNPKG

plantuml-pipe

Version:

Generate multiple PlantUML diagrams with one JAVA process

54 lines (53 loc) 1.92 kB
/// <reference types="node" /> /// <reference types="node" /> import { Readable, Writable } from "stream"; import { PlantUmlPipeOptions } from "./plantuml_pipe_options"; /** * Class that wraps a PlantUML diagram generator running in pipe mode. */ export declare class PlantUmlPipe { /** * Process object for the PlantUML JAVA process that is spawned. */ private readonly javaProcess; /** * Input stream of the object into which PlantUML code can be sent. */ private readonly inputStream; /** * Output stream of the object into which the diagrams are written. */ private readonly outputStream; /** * Collection of promise resolver functions used for the "process" method that returns a promise. */ private readonly resolvers; /** * Creates a new PlantUML pipe. * @param userOptions Possible user defined options for the PlantUML generating pipe. */ constructor(userOptions?: Readonly<PlantUmlPipeOptions>); /** * @returns The input stream into which to write the PlantUML code of the diagrams. */ get in(): Writable; /** * @returns The output stream from which to read the generated PlantUML diagram images. */ get out(): Readable; /** * Closes the input stream of the PlantUML diagram generator. */ close(): void; /** * Resolves the currently first promise in the queue by calling its corresponding resolve function. * @param imageData The gnerated image data that is passed to the resolve function of the promise. */ private readonly resolvePromise; /** * Generates a PlantUML diagram image from the given PlantUML code. * @param plantUml The PlantUML code. * @returns A promise with the data of the generated PlantUML diagram image. */ process<T extends string | Readonly<Buffer>>(plantUml: string): Promise<T>; }