API Reference

clipboardy

Cross-platform clipboard read/write for Node.js CLIs, supporting macOS, Linux, and Windows with sync and async APIs.

Official Documentation ↗
CompatibilityThis documentation covers version v5.3.2. Check the official docs for the latest API surface.

Installation

npmnpm install clipboardy

Methods

clipboardy is cross-platform clipboard read/write for node.js clis, supporting macos, linux, and windows with sync and async apis. This page documents the core methods, installation, and common usage patterns for the current stable release.

Installation

Install clipboardy with your preferred package manager using the command shown in the frontmatter. The package is published to the npm registry and ships with TypeScript types where applicable.

Core methods

The methods listed in the frontmatter cover the primary API surface. Each signature reflects the v4.0 release. Consult the official documentation linked in sourceUrl for advanced options, edge cases, and breaking changes between major versions.

Frequently asked questions

The faq section in the frontmatter answers the most common questions about clipboardy, including comparisons with alternatives, configuration tips, and runtime requirements. If your question is not covered, check the source URL for the full guide.

Security

Official security statements captured from the package documentation:

API reference evidence

Fetched from official sources on 2026-11-08T19:27:00+08:00 via WebFetch https://raw.githubusercontent.com/sindresorhus/clipboardy/main/readme.md(另尝试 index.d.ts 两次均返回空内容,未取得类型声明).

FAQ

How does it work on Linux?
It uses xclip or xsel; install one of them on headless systems.
Does it work over SSH?
Only if X11 forwarding is enabled; otherwise the clipboard tool has no display.
Is it ESM-only?
v4 is ESM-only; use v3 for CommonJS support.