File: linux.js

package info (click to toggle)
node-copy-paste 1.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 108 kB
  • sloc: javascript: 165; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 531 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
exports.copy =
 	process.env.WSL_DISTRO_NAME ?
	{ command: "clip.exe", args: [] } :
  	{ command: "xclip", args: [ "-selection", "clipboard" ] };

exports.paste = { command: "xclip", args: [ "-selection", "clipboard", "-o" ] };
exports.paste.full_command = [ exports.paste.command ].concat(exports.paste.args).join(" ");
exports.encode = function(str) { return Buffer.from(str, "utf8"); };
exports.decode = function(chunks) {
	if(!Array.isArray(chunks)) { chunks = [ chunks ]; }

	return Buffer.concat(chunks).toString("utf8");
};