electron-clipboard-xh
v1.0.2
Published
Extended electron.js clipboard module and From author kenan2002
Downloads
2
Readme
electron-clipboard-xh
A node.js native addon designed to use with electron to extend its clipboard features.
build
Read file paths copied from macOS Finder or Windows explorer:
npm install
node-gyp build
Example
Read file paths copied from macOS Finder or Windows explorer:
const clipboardEx = require("electron-clipboard-xh");
const filePaths = clipboardEx.readFilePaths();
Write file paths to clipboard:
const clipboardEx = require("electron-clipboard-xh");
clipboardEx.writeFilePaths(filePaths);
Clear clipboard:
const clipboardEx = require("electron-clipboard-xh");
clipboardEx.clear();
Save clipboard image as jpeg:
const clipboardEx = require("electron-clipboard-xh");
// sync
clipboardEx.saveImageAsJpegSync(targetPath, compressFactor);
// async
await clipboardEx.saveImageAsJpeg(targetPath, compressFactor);
Save clipboard image as png:
const clipboardEx = require("electron-clipboard-xh");
// sync
clipboardEx.saveImageAsPngSync(targetPath);
// async
await clipboardEx.saveImageAsPng(targetPath);
Put image into clipboard:
const clipboardEx = require("electron-clipboard-xh");
// sync
clipboardEx.putImageSync(imagePath);
// async
await clipboardEx.putImage(imagePath);
Check if clipboard has an image in it:
const clipboardEx = require("electron-clipboard-xh");
clipboardEx.hasImage();
Operating system support
This library supports Windows and macOS. Linux is currently not supported, feel free to open a pull request if you need it.