clipboard
Perform copy and paste operations on the system clipboard.
await eagle.clipboard.writeText('Example string');
console.log(await eagle.clipboard.readText());Methods
clear()
Clear the clipboard content.
eagle.clipboard.writeText('Example string');
eagle.clipboard.clear();
console.log(eagle.clipboard.readText()); // undefinedhas(format)
Check if the current clipboard content contains the specified format.
formatstring - Specified formatReturns boolean - Whether it contains the specified format
console.log(eagle.clipboard.has('public/utf8-plain-text')); // false
const buffer = Buffer.from('writeBuffer', 'utf8');
eagle.clipboard.writeBuffer('public/utf8-plain-text', buffer);
console.log(eagle.clipboard.has('public/utf8-plain-text')); // truewriteText(text)
Write text as plain text to the clipboard.
textstring - Text to be written
eagle.clipboard.writeText('Example string');
console.log(eagle.clipboard.readText()); // 'Example string'readText()
Get the plain text content of the current clipboard.
Returns string
console.log(await eagle.clipboard.readText());writeBuffer(format, buffer)
Write buffer as format type to the clipboard.
formatstring - Clipboard formatbufferBuffer - Buffer format of the content to be written
const buffer = Buffer.from('writeBuffer', 'utf8');
eagle.clipboard.writeBuffer('public/utf8-plain-text', buffer);readBuffer(format)
Read format type content from the clipboard.
Returns Buffer
const buffer = Buffer.from('this is binary', 'utf8');
eagle.clipboard.writeBuffer('public/utf8-plain-text', buffer);
const out = eagle.clipboard.readBuffer('public/utf8-plain-text');
console.log(buffer.equals(out)); // truewriteImage(image)
Write image to the clipboard.
imageNativeImage - Image to be written to the clipboard
let img = nativeImage.createFromPath('path_to_img_file');
eagle.clipboard.writeImage(img);readImage()
Read image format content from the clipboard.
Returns NativeImage
let input = nativeImage.createFromPath('path_to_img_file');
eagle.clipboard.writeImage(input);
let output = eagle.clipboard.readImage();writeHTML(markup)
Write markup as HTML format to the clipboard.
markupstring
eagle.clipboard.writeHTML('<b>Hi</b>');
console.log(eagle.clipboard.readHTML()); // <b>Hi</b>readHTML()
Read HTML format content from the clipboard.
Returns string
eagle.clipboard.writeHTML('<b>Hi</b>');
console.log(eagle.clipboard.readHTML()); // <b>Hi</b>copyFiles(paths)
Copy the specified files to the clipboard, supporting paste in file manager.
pathsstrings[] - Files to be copied to the clipboard.
eagle.clipboard.copyFiles([
'path_to_file',
'path_to_file2'
]);Last updated