Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 1.86 KB

PipelineInsight.md

File metadata and controls

37 lines (27 loc) · 1.86 KB

Creating and Using Pipelines in ToolX

Introduction to Pipelines

Pipelines in ToolX are powerful constructs designed to handle complex sequences of file processing tasks. They allow for the chaining of multiple operations, providing a structured and efficient approach to manage workflows.

Sequential Processing in Pipelines

  • Sequential Order: Pipelines in ToolX process tasks in a defined sequence, ensuring each step is completed before moving to the next.
  • Error Handling: By managing tasks sequentially, pipelines help in efficient error handling and smooth progression through the processing steps.

Pipeline Creation and Usage

Creating a pipeline involves defining a series of tasks (tools) and the order in which they should be executed. Pipelines can integrate various tools, allowing for a composite and versatile processing solution.

Code Examples with Explanations

Below are examples of creating and using pipelines in ToolX:

import { Pipeline } from '@toolx/core';
import CustomToolOne from './CustomToolOne';
import CustomToolTwo from './CustomToolTwo';

// Creating a new pipeline instance
const myPipeline = new Pipeline({ /* options */ }, 'path/to/input', 'path/to/output');

// Adding tools to the pipeline
myPipeline.compose(
    new CustomToolOne({ /* options */ }),
    new CustomToolTwo({ /* options */ })
)().then(() => {
    console.log('Pipeline processing complete');
});

This example demonstrates the basic structure of a pipeline, integrating two custom tools. Each tool in the pipeline performs its task in the order they are added.

Conclusion

Understanding the architecture and functionality of pipelines is crucial in ToolX for creating sophisticated and efficient file processing workflows. This guide aims to provide foundational knowledge and practical examples to empower developers in building effective pipelines.