clipboard-copy-paste-helper

1.0.2 • Public • Published

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.

Package Sidebar

Install

npm i clipboard-copy-paste-helper

Weekly Downloads

6

Version

1.0.2

License

MIT

Unpacked Size

2.32 kB

Total Files

4

Last publish

Collaborators

  • eternaldarron