clipboard

Perform copy and paste operations on the system clipboard.

Tip: It is recommended to use Clipboard Viewer (Win / Mac) tool for development debugging to make the development process smoother.

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());	// undefined

has(format)

Check if the current clipboard content contains the specified format.

  • format string - Specified format

  • Returns boolean - Whether it contains the specified format


writeText(text)

Write text as plain text to the clipboard.

  • text string - Text to be written


readText()

Get the plain text content of the current clipboard.

  • Returns string


writeBuffer(format, buffer)

Write buffer as format type to the clipboard.

  • format string - Clipboard format

  • buffer Buffer - Buffer format of the content to be written


readBuffer(format)

Read format type content from the clipboard.

  • Returns Buffer


writeImage(image)

Write image to the clipboard.

  • image NativeImage - Image to be written to the clipboard


readImage()

Read image format content from the clipboard.


writeHTML(markup)

Write markup as HTML format to the clipboard.

  • markup string


readHTML()

Read HTML format content from the clipboard.

  • Returns string


copyFiles(paths)

Copy the specified files to the clipboard, supporting paste in file manager.

  • paths strings[] - Files to be copied to the clipboard.


Last updated