{"name":"clipboardy","version":"5.3.0","keywords":["clipboard","copy","paste","copy-paste","pasteboard","read","write","pbcopy","clip","xclip","xsel"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"clipboardy@5.3.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/clipboardy#readme","bugs":{"url":"https://github.com/sindresorhus/clipboardy/issues"},"ava":{"serial":true},"dist":{"shasum":"ce9fd3647482cdd9e8596c5717456d2e6fa6e4fe","tarball":"http://registry-npm.ywwl.com/clipboardy/download/clipboardy-5.3.0.tgz","fileCount":16,"integrity":"sha512-EOei1RJTbqXbXhUBMGN8C/Pf+QIPrnDWx9ztlmcW5Hljqj/oVlPrlrDw2O4xh5ViHcvHX3+A0zBrCdcptKTaJA==","signatures":[{"sig":"MEUCIQD7dAl4ekL1Socl3jqqUYIVYH0xFs/hgNffCUhexdQlDAIgG0hIjVCDOLHgCBFPqsog7bezINa68USHgEZrxfk/LzU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2792640,"size":1172551,"noattachment":false,"key":"/clipboardy/-/clipboardy-5.3.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"node":"./index.js","types":"./index.d.ts","default":"./browser.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"7856f0a11513de743f3fadf14406856dc8e17221","scripts":{"test":"ava","//test":"xo && ava"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/clipboardy.git","type":"git"},"_npmVersion":"11.8.0","description":"Access the system clipboard (copy/paste)","directories":{},"sideEffects":false,"_nodeVersion":"25.6.0","dependencies":{"execa":"^9.6.1","is-wsl":"^3.1.0","is64bit":"^2.0.0","is-wayland":"^0.1.0","clipboard-image":"^0.1.0","powershell-utils":"^0.2.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","ava":"^6.4.1"},"_npmOperationalInternal":{"tmp":"tmp/clipboardy_5.3.0_1770879600492_0.8858742844175189","host":"s3://npm-registry-packages-npm-production"},"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":1770879600711,"_cnpm_publish_time":1770879600711,"dist-tags":{"latest":"5.3.2"}}