Interactive ManagerGetting Started
Getting Started
Install and start using the interactive manager
Installation
Install the package using your preferred package manager:
pnpm add @visulima/interactive-managerbash npm install @visulima/interactive-manager bash yarn add @visulima/interactive-manager bun add @visulima/interactive-managerBasic Usage
Setting Up
The interactive manager requires two stream hooks — one for stdout and one for stderr:
import { InteractiveManager, InteractiveStreamHook } from "@visulima/interactive-manager";
const stdoutHook = new InteractiveStreamHook(process.stdout);
const stderrHook = new InteractiveStreamHook(process.stderr);
const manager = new InteractiveManager(stdoutHook, stderrHook);Updating Output
Once hooked, you can dynamically update terminal output:
manager.hook();
// Write multiple lines
manager.update("stdout", ["Line 1", "Line 2", "Line 3"]);
// Update with new content (previous lines are erased)
manager.update("stdout", ["Updated line 1", "Updated line 2"]);
manager.unhook();Suspend and Resume
Temporarily pause interactive mode to allow external output:
manager.hook();
manager.update("stdout", ["Processing..."]);
// Pause interactive mode
manager.suspend("stdout");
console.log("This message appears normally");
// Resume interactive mode
manager.resume("stdout");
manager.update("stdout", ["Still processing..."]);
manager.unhook();See Also
- Usage Guide - Complete API reference