{"_id":"clipboard-image","_rev":"4308680","name":"clipboard-image","description":"Get and set images on the macOS clipboard","dist-tags":{"latest":"0.1.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-04-07T21:44:11.000Z","created":"2025-08-27T12:04:36.509Z","0.1.0":"2025-08-27T12:04:36.509Z"},"users":{},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/clipboard-image.git"},"versions":{"0.1.0":{"name":"clipboard-image","version":"0.1.0","description":"Get and set images on the macOS clipboard","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/clipboard-image.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","bin":{"clipboard-image":"cli.js"},"exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=20"},"scripts":{"test":"xo && ava"},"keywords":["clipboard","image","images","pasteboard","macos","mac","copy","paste","nspasteboard"],"dependencies":{"run-jxa":"^3.0.0"},"devDependencies":{"ava":"^6.4.1","xo":"^1.2.2"},"_id":"clipboard-image@0.1.0","gitHead":"210e4e59e13199b7970205dd820f7938b50af551","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/clipboard-image/issues"},"homepage":"https://github.com/sindresorhus/clipboard-image#readme","_nodeVersion":"20.19.1","_npmVersion":"10.9.2","dist":{"shasum":"e067250ddfebaff3e4379f9d9290c98786375bb1","size":3959,"noattachment":false,"key":"/clipboard-image/-/clipboard-image-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/clipboard-image/download/clipboard-image-0.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/clipboard-image_0.1.0_1756296276301_0.12511529395335041"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-08-27T12:04:36.509Z","publish_time":1756296276509,"_source_registry_name":"default","_cnpm_publish_time":1756296276509}},"readme":"# clipboard-image\n\n> Get and set images on the macOS clipboard\n\n## Install\n\n```sh\nnpm install clipboard-image\n```\n\n## Usage\n\n```js\nimport {\n\twriteClipboardImages,\n\treadClipboardImages\n} from 'clipboard-image';\n\nawait writeClipboardImages(['screenshot.png', 'photo.jpg']);\n\nconsole.log(await readClipboardImages());\n//=> ['/var/folders/.../clipboard-image-1.png', '/var/folders/.../clipboard-image-2.png']\n```\n\n## API\n\n### `hasClipboardImages()`\n\nCheck if there are images on the clipboard.\n\nReturns a `Promise<boolean>`.\n\nOn non-macOS platforms, it returns `false`.\n\n### `readClipboardImages()`\n\nRead images from the clipboard.\n\nYou get PNG files no matter what image types they were on the clipboard to make it easier to handle.\n\nReturns a `Promise<string[]>` with paths to the saved PNG files. You are in charge of these files. You can move them somewhere else or clean them up when you are done.\n\nOn non-macOS platforms, it returns an empty array.\n\n### `writeClipboardImages(filePaths)`\n\nWrite images to the clipboard.\n\nSupports any image type that macOS supports, which includes PNG, JPEG, HEIC, WebP, GIF.\n\nOn non-macOS platforms, it does nothing.\n\n#### filePaths\n\nType: `Array<string | URL>`\n\nAn array of file paths and file URL objects pointing to image files.\n\n## CLI\n\n```sh\n# Read images from clipboard and output file paths\nclipboard-image\n\n# Write images to clipboard\nclipboard-image image1.png image2.jpg\n```\n\nWhen reading from clipboard, if there are images, they will be saved to a temporary directory and the file paths will be printed (one per line).\n\nWhen writing to clipboard, provide one or more image file paths as arguments.\n\n## Related\n\n- [clipboardy](https://github.com/sindresorhus/clipboardy) - Access text on the system clipboard (copy/paste)\n- [copy-text-to-clipboard](https://github.com/sindresorhus/copy-text-to-clipboard) - Copy text to the clipboard in the browser\n","_attachments":{},"homepage":"https://github.com/sindresorhus/clipboard-image#readme","bugs":{"url":"https://github.com/sindresorhus/clipboard-image/issues"},"license":"MIT"}