1.1 KiB
1.1 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])
typeString
Returns the content in clipboard as plain text.
clipboard.writeText(text[, type])
textStringtypeString
Writes the text into clipboard as plain text.
clipboard.clear([type])
typeString
Clears everything in clipboard.
clipboard.has(format[, type])
formatStringtypeString
Returns whether clipboard has data in specified format.
Note: This API is experimental and could be removed in future.
clipboard.read(format[, type])
formatStringtypeString
Reads the data in clipboard of the format.
Note: This API is experimental and could be removed in future.