MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / copyToClipBoard

Function copyToClipBoard

local-cli/server/util/copyToClipBoard.js:22–39  ·  view source on GitHub ↗

* Copy the content to host system clipboard. * This is only supported on Mac and Windows for now.

(content)

Source from the content-addressed store, hash-verified

20 * This is only supported on Mac and Windows for now.
21 */
22function copyToClipBoard(content) {
23 switch (process.platform) {
24 case 'darwin':
25 var child = spawn('pbcopy', []);
26 child.stdin.end(new Buffer(content, 'utf8'));
27 return true;
28 case 'win32':
29 var child = spawn('clip', []);
30 child.stdin.end(new Buffer(content, 'utf8'));
31 return true;
32 case 'linux':
33 var child = spawn(xsel, ['--clipboard', '--input']);
34 child.stdin.end(new Buffer(content, 'utf8'));
35 return true;
36 default:
37 return false;
38 }
39}
40
41module.exports = copyToClipBoard;

Callers 1

Calls 1

endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…