{"name":"clipboardy","version":"5.3.2","description":"Access the system clipboard (copy/paste)","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/clipboardy.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","node":"./index.js","default":"./browser.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"//test":"xo && ava","test":"ava"},"keywords":["clipboard","copy","paste","copy-paste","pasteboard","read","write","pbcopy","clip","xclip","xsel"],"dependencies":{"clipboard-image":"^0.1.0","execa":"^9.6.1","is-wayland":"^0.1.0","is-wsl":"^3.1.0","is64bit":"^2.0.0","powershell-utils":"^0.2.0"},"devDependencies":{"ava":"^6.4.1","xo":"^1.2.2"},"ava":{"serial":true},"gitHead":"84e8d07ceacba32d95e9072efcb7d486578ac9d2","types":"./index.d.ts","_id":"clipboardy@5.3.2","bugs":{"url":"https://github.com/sindresorhus/clipboardy/issues"},"homepage":"https://github.com/sindresorhus/clipboardy#readme","_nodeVersion":"22.23.1","_npmVersion":"11.18.0","dist":{"integrity":"sha512-R35PENCHFCw6lsd5SjYPuAVV3Zawr74mKc7ogFNzoDPoQsmWDoJgUNNnWCk/czeqdZGZs8Y0M8zkOlVoySfHEQ==","shasum":"40fcdc0c41a4bd37cfd109e438a46352813bf5bb","tarball":"http://registry-npm.ywwl.com/clipboardy/download/clipboardy-5.3.2.tgz","fileCount":16,"unpackedSize":875247,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDGgPai19pDeoJUaR55dvgQ6z7WBSAEILomvjNVUSheyAIhAJnJ6F5wBL2WPkkxluG3JTBaDDlpQq3cnjeaaiXKEAeE"}],"size":447051,"noattachment":false,"key":"/clipboardy/-/clipboardy-5.3.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/clipboardy_5.3.2_1784807076987_0.7816145578113445"},"_hasShrinkwrap":false,"readme":"# clipboardy\n\n> Access the system clipboard (copy/paste)\n\nCross-platform. Supports: macOS, Windows, Linux (including Wayland), OpenBSD, FreeBSD, Android with [Termux](https://termux.com/), and [modern browsers](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API#Browser_compatibility).\n\n## Install\n\n```sh\nnpm install clipboardy\n```\n\n## Usage\n\n```js\nimport clipboard from 'clipboardy';\n\nawait clipboard.write('🦄');\n\nawait clipboard.read();\n//=> '🦄'\n\n// Or use the synchronous API\nclipboard.writeSync('🦄');\n\nclipboard.readSync();\n//=> '🦄'\n```\n\n## API\n\n**Browser usage:** Requires a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts) (HTTPS). Synchronous methods are not available in browsers.\n\n### clipboard\n\n#### .write(text)\n\nWrite (copy) to the clipboard asynchronously.\n\nReturns a `Promise<void>`.\n\n##### text\n\nType: `string`\n\nThe text to write to the clipboard.\n\n```js\nawait clipboard.write('🦄');\n```\n\n#### .read()\n\nRead (paste) from the clipboard asynchronously.\n\nReturns a `Promise<string>`.\n\n```js\nconst content = await clipboard.read();\n//=> '🦄'\n```\n\n#### .writeSync(text)\n\nWrite (copy) to the clipboard synchronously.\n\n**Doesn't work in browsers.**\n\n##### text\n\nType: `string`\n\nThe text to write to the clipboard.\n\n```js\nclipboard.writeSync('🦄');\n```\n\n#### .readSync()\n\nRead (paste) from the clipboard synchronously.\n\nReturns a `string`.\n\n**Doesn't work in browsers.**\n\n```js\nconst content = clipboard.readSync();\n//=> '🦄'\n```\n\n#### .writeImages(filePaths)\n\nWrite (copy) images to the clipboard asynchronously.\n\nReturns a `Promise<void>`.\n\n**Only supported on macOS.** On other platforms, this is a no-op.\n\n##### filePaths\n\nType: `string[]`\n\nThe file paths of the images to write to the clipboard. Supports any image type that macOS supports, including PNG, JPEG, HEIC, WebP, and GIF.\n\n```js\nawait clipboard.writeImages(['/path/to/image.png']);\n```\n\n#### .readImages()\n\nRead images from the clipboard asynchronously.\n\nReturns a `Promise<string[]>` with file paths to temporary PNG files. You are responsible for cleaning up the files.\n\n**Only supported on macOS.** On other platforms, this returns an empty array.\n\n```js\nconst filePaths = await clipboard.readImages();\n```\n\n#### .hasImages()\n\nCheck if the clipboard contains images.\n\nReturns a `Promise<boolean>`.\n\n**Only supported on macOS.** On other platforms, this returns `false`.\n\n```js\nconst hasImages = await clipboard.hasImages();\n```\n\n## FAQ\n\n#### Does this work in headless Linux environments?\n\nNo. Clipboard operations on Linux require a display server (X11 or Wayland). Headless environments like CI servers or Raspberry Pi without a desktop environment do not have a system clipboard.\n\n#### Where can I find the source of the bundled binaries?\n\nThe [Linux binary](fallbacks/linux/xsel) is just a bundled version of [`xsel`](https://linux.die.net/man/1/xsel). The source for the [Windows binary](fallbacks/windows/clipboard_x86_64.exe) can be found [here](https://github.com/sindresorhus/win-clipboard).\n\nOn Windows, clipboardy first tries the native PowerShell cmdlets (`Set-Clipboard`/`Get-Clipboard`) and falls back to the bundled binary if PowerShell is unavailable or restricted.\n\n#### Does this work on Wayland?\n\nYes. On Linux, clipboardy automatically detects Wayland sessions and uses [`wl-clipboard`](https://github.com/bugaevc/wl-clipboard) when available. If not, it gracefully falls back to X11 tools. Also works with WSLg (Windows Subsystem for Linux GUI). Install `wl-clipboard` using your distribution's package manager.\n\n## Related\n\n- [clipboard-cli](https://github.com/sindresorhus/clipboard-cli) - CLI for this module\n- [clipboard-image](https://github.com/sindresorhus/clipboard-image) - Get and set images on the clipboard\n- [copy-text-to-clipboard](https://github.com/sindresorhus/copy-text-to-clipboard) - Copy text to the clipboard in the browser\n","publish_time":1784807077211,"_cnpm_publish_time":1784807077211,"dist-tags":{"latest":"5.3.2"}}