Introduction
cli-screencast is an easy to use Node.js package designed to capture and render terminal screenshots and recordings to SVG or PNG formats.
Features:
- Capture terminal recordings from a variety of sources like spawned processes, shell sessions, and Node.js code.
- Generate clean, high-resolution SVG or PNG images of the captured terminal output.
- Customize rendering to fine-tune the look and feel of your terminal output, adjusting colors, fonts, and other visual elements.
Installation
Install the module using your Node.js package manager of choice:
- npm
- Yarn
- pnpm
npm install cli-screencast
yarn add cli-screencast
pnpm add cli-screencast
Usage
The package exports six key functions:
Renders a single-frame terminal screenshot - ideal for capturing the state of the terminal at a specific point in time.
Records the output of a spawned subprocess - ideal for showcasing CLI tools.
Launches and records an entire shell session, capturing everything that occurs within the shell - ideal for creating tutorials or demos.
Captures terminal output within a callback function, giving you fine-grained control over what output to capture.
Renders a recording from an array of terminal frames - ideal for when you need to control the content and timing of each frame in a capture.
Renders either a screenshot or a full recording from a data file generated by one of the other api methods.