A utility library for simplifying clipboard operations (copy and paste) in web applications.
To install clipboard-copy-paste-helper
, run:
npm install clipboard-copy-paste-helper
The library provides two main functions: copyTextToClipboard
for copying text to the clipboard, and pasteTextFromClipboard
for pasting text from the clipboard.
const { copyTextToClipboard } = require('clipboard-copy-paste-helper');
copyTextToClipboard('Hello, world!').then(() => {
console.log('Text copied successfully!');
});
const { pasteTextFromClipboard } = require('clipboard-copy-paste-helper');
pasteTextFromClipboard().then(text => {
console.log('Pasted text:', text);
});
Note: Clipboard operations require user interaction in most browsers (e.g., inside a click event handler) and may also require specific permissions or secure contexts (https).
This project is licensed under the MIT License.