A command line utility that allows read/write (i.e copy/paste) access to the system clipboard.
支持OSX、Linux、Windows
另一个下载量更大的库:clipboardy
文档
- github https://github.com/xavi-/node-copy-paste
- npmjs https://www.npmjs.com/package/copy-paste
安装
npm install copy-paste
示例
import ncp from "copy-paste";
// 向剪切板写入内容
ncp.copy("some text", function () {
// complete...
});
// 从剪切板读取内容
let res = ncp.paste();
console.log(res);
参考 Node.js 复制至剪贴板