getProcessSize
getProcessSize (aliased as ps) reads the current terminal dimensions at the moment it is called, returning a TerminalDimensions object. For a one-time snapshot taken at import time, use the exported constant size instead.
Signature
function getProcessSize(): TerminalDimensions
// Static snapshot captured at module load time
const size: TerminalDimensions
Return Value
A TerminalDimensions object whose width and height properties each carry a TerminalSize with pre-computed og, half, third, twoThirds, and full values.
Aliases
Exported as both getProcessSize and ps.
Usage
import { getProcessSize } from "ts-better-console";
const dim = getProcessSize();
console.log("Terminal width:", dim.width.og);
console.log("Half width:", dim.width.half);
Want to support this project?
If you find ts-better-console useful and want to support its development, consider starring the GitHub repository or buying me a coffee! Your support helps me dedicate more time to improving the library and adding new features.
Want to contribute to this project?
Contributions are welcome! If you're interested in improving the library, fixing bugs, or adding new features, feel free to check out the GitHub repository and submit a pull request. Whether you're a seasoned developer or new to open source, your contributions can make a difference!