API Reference
ansi-escapes
ANSI escape code sequences for the terminal, covering cursor movement, screen control, and links.
Official Documentation ↗CompatibilityThis documentation covers version
v7. Check the official docs for the latest API surface.Installation
npm
npm install ansi-escapesMethods
No methods match this filter.
ansi-escapes exposes named helpers instead of raw escape sequences for common terminal operations.
Key Features
- Cursor up, down, and positioning
- Screen and line clearing
- Terminal hyperlinks and window titles
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
Security notes
Quoted verbatim from the official documentation; this is not a complete threat model. 来源:https://cdn.jsdelivr.net/gh/sindresorhus/ansi-escapes@latest/readme.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:09.423Z.
- An annotation looks like this when shown: See the iTerm Proprietary Escape Codes documentation for more information. (https://cdn.jsdelivr.net/gh/sindresorhus/ansi-escapes@latest/readme.md)
- Related - ansi-styles - ANSI escape codes for styling strings in the terminal (https://cdn.jsdelivr.net/gh/sindresorhus/ansi-escapes@latest/readme.md)
FAQ
- Why do escape codes show as garbage?
- The terminal may not understand them, or output is redirected to a file. Gate on process.stdout.isTTY before emitting control sequences.
- Does link work everywhere?
- Most modern terminals support OSC 8 hyperlinks, but some do not and will show the plain text, which is a safe fallback.
- How do I clear just one line?
- Use eraseLine() after cursorUp() to rewrite a status line without clearing the whole screen.
Report a problem with this API docOpens a pre-filled issue on GitHub.