1.4 KiB
1.4 KiB
clipboard
The clipboard
provides methods to do copy/paste operations. An example of
writing a string to clipboard:
var clipboard = require('clipboard');
clipboard.writeText('Example String');
On X Window systems, there is also a selection clipboard, to manipulate in it
you need to pass selection
to each method:
var clipboard = require('clipboard');
clipboard.writeText('Example String', 'selection');
console.log(clipboard.readText('selection'));
clipboard.readText([type])
type
String
Returns the content in clipboard as plain text.
clipboard.writeText(text[, type])
text
Stringtype
String
Writes the text
into clipboard as plain text.
clipboard.readImage([type])
type
String
Returns the content in clipboard as NativeImage.
clipboard.writeImage(image[, type])
image
NativeImagetype
String
Writes the image
into clipboard.
clipboard.clear([type])
type
String
Clears everything in clipboard.
clipboard.has(format[, type])
format
Stringtype
String
Returns whether clipboard has data in specified format
.
Note: This API is experimental and could be removed in future.
clipboard.read(format[, type])
format
Stringtype
String
Reads the data in clipboard of the format
.
Note: This API is experimental and could be removed in future.