Sometimes, we want to copy to clipboard in Node.js.
In this article, we’ll look at how to copy to clipboard in Node.js.
How to copy to clipboard in Node.js?
To copy to clipboard in Node.js, we use the clipboardy
library.
To install it, we run
npm install clipboardy
Then we write
const clipboardy = require('clipboardy');
clipboardy.writeSync('hello world');
clipboardy.readSync();
to call clipboardy.writeSync
to write 'hello world'
to the clipboard.
And we call readSync
to read the content of the clipboard.
Conclusion
To copy to clipboard in Node.js, we use the clipboardy
library.