clipboard-copy-paste-helper
v1.0.2
Published
Simplify clipboard operations (copy and paste) in web applications.
Downloads
2
Maintainers
Readme
clipboard-copy-paste-helper
A utility library for simplifying clipboard operations (copy and paste) in web applications.
Installation
To install clipboard-copy-paste-helper
, run:
npm install clipboard-copy-paste-helper
Usage
The library provides two main functions: copyTextToClipboard
for copying text to the clipboard, and pasteTextFromClipboard
for pasting text from the clipboard.
Copying Text to Clipboard
const { copyTextToClipboard } = require('clipboard-copy-paste-helper');
copyTextToClipboard('Hello, world!').then(() => {
console.log('Text copied successfully!');
});
Pasting Text from Clipboard
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).
License
This project is licensed under the MIT License.