Gathering detailed insights and metrics for copy-to-clipboard
Gathering detailed insights and metrics for copy-to-clipboard
Copy stuff into clipboard from your browser using JS
npm install copy-to-clipboard
Typescript
Module System
Node Version
NPM Version
99.4
Supply Chain
90.3
Quality
75.8
Maintenance
100
Vulnerability
100
License
JavaScript (70.62%)
HTML (24.71%)
CSS (4.67%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,202,602,366
Last Day
237,711
Last Week
6,137,657
Last Month
24,484,813
Last Year
278,938,145
MIT License
1,333 Stars
131 Commits
130 Forks
9 Watchers
4 Branches
19 Contributors
Updated on Jan 24, 2025
Minified
Minified + Gzipped
Latest Version
3.3.3
Package Id
copy-to-clipboard@3.3.3
Unpacked Size
14.78 kB
Size
6.26 kB
File Count
8
NPM Version
8.19.2
Node Version
18.12.1
Cumulative downloads
Total Downloads
Last Day
-11.9%
237,711
Compared to previous day
Last Week
1.5%
6,137,657
Compared to previous week
Last Month
28.8%
24,484,813
Compared to previous month
Last Year
7.1%
278,938,145
Compared to previous year
1
Simple module exposing copy
function that will try to use execCommand with fallback to IE-specific clipboardData
interface and finally, resort to usual prompt
with proper text content and message.
1import copy from 'copy-to-clipboard'; 2 3copy('Text'); 4 5// Copy with options 6copy('Text', { 7 debug: true, 8 message: 'Press #{key} to copy', 9});
copy(text: string, options: object): boolean
— tries to copy text to clipboard. Returns true
if no additional keystrokes were required from user (so, execCommand
, IE's clipboardData
worked) or false
.
Value | Default | Notes |
---|---|---|
options.debug | false | Boolean . Optional. Enable output to console. |
options.message | Copy to clipboard: #{key} , Enter | String . Optional. Prompt message. * |
options.format | "text/html" | String . Optional. Set the MIME type of what you want to copy as. Use text/html to copy as HTML, text/plain to avoid inherited styles showing when pasted into rich text editor. |
options.onCopy | null | function onCopy(clipboardData: object): void . Optional. Receives the clipboardData element for adding custom behavior such as additional formats |
*
all occurrences of #{key}
are replaced with ⌘+C
for macOS/iOS users, and Ctrl+C
otherwise.
Works everywhere where prompt
* is available. Works best (i.e. without additional keystrokes) in Chrome, FF, Safari 10+, and, supposedly, IE/Edge.
Note: does not work on some older iOS devices.
*
– even though Safari 8 has prompt
, you cannot specify prefilled content for prompt modal – thus it doesn't work as expected.
npm i --save copy-to-clipboard
1<script src="https://wzrd.in/standalone/copy-to-clipboard@latest" async></script>
You will have window.copyToClipboard
exposed for you to use.
This project has some automated tests, that will run using nightwatch on top of selenium.
npm i
npm test
This library has built-in Typescript definitions.
import * as copy from 'copy-to-clipboard';
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/27 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
14 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More