Async clipboard api uses navigator.clipboard if available or smallest polyfill in the world.
npm i @cloudcmd/clipboard
Write text to clipboard.
const clipboard = require('@cloudcmd/clipboard');
clipboard.writeText('hello')
.then(console.log)
.catch(console.error);MIT