Archived post: posted sometime between 2016 and 2022.
const output = "some string"; require("child_process").spawn("clip").stdin.end(output);