We can use the clipboardy npm package to copy text to the clipboard or read the clipboard.
clipboardy
Install it by running npm i clipboardy
npm i clipboardy
Usage:
const clipboardy = require('clipboardy'); // Copy some text to the clipboard clipboardy.writeSync('Lorem ipsum dolor sit amet'); // Read the text from the clipboard clipboardy.readSync();