Index
This documentation contains the following sections
About
This is a npm package that lets user to copy things onto their system's clipboard. This package works on all type of operating system like Windows, Ubuntu and Mac
Package Requirements
| Tech Name | Required |
|---|---|
| Powershell | Yes |
| Node.js | Yes |
| Visual Studio Code | No |
You can choose any editor of your choice.
Installation Steps
Open your terminal and run the following commands one by one to install powershell.
If you are using Windows 10 or higher, you don't need to install PowerShell separately on your system, as it is already included in the operating system.
Step 1
sudo apt-get update
Step 2
sudo apt-get install -y wget apt-transport-https
software-properties-common
Step 3
source /etc/os-release
Step 4
wget -q
https://packages.microsoft.com/config/ubuntu/$VERSION_ID/packages-microsoft-prod.deb
Step 5
sudo dpkg -i packages-microsoft-prod.deb
Step 6
rm packages-microsoft-prod.deb
Step 7
sudo apt-get update
Step 8
sudo apt-get install -y powershell
Step 9
pwsh
Usage
Follow the following code in order to use this package.
Step 1
const Clipboards=require("@book-junction/clipboards/build");
Step 2
const object = new Clipboards.default();
Step 3
(async () => await object.copy("text to copy"));
Copy method can throw errors, so please handle them gracefully.
Where it can be used?
This package has numerous use cases, but one practical example is its application in writing Node.js commit message generator scripts. With it, you can automatically paste the generated commit message onto the system's clipboard.
Where to download?
This project is hoisted live on npm.js website. Click here to view.