@jsvision/core / setClipboard
Function: setClipboard()
setClipboard(
text,caps):string
Defined in: render/osc.ts:58
Emit an OSC 52 clipboard-write of text. The text is base64-encoded verbatim (no sanitize) so the exact bytes — including newlines — land on the clipboard; base64 output cannot break out of the OSC 52 frame, so the sequence stays injection-safe regardless. Returns '' when the terminal lacks clipboard support.
Parameters
text
string
Text to place on the clipboard; encoded byte-for-byte.
caps
Resolved terminal capabilities.
Returns
string
The ANSI string to write to the terminal, or '' if unsupported.
Example
ts
import { setClipboard, resolveCapabilities } from '@jsvision/core';
const caps = resolveCapabilities().profile;
process.stdout.write(setClipboard('copied from my TUI', caps));