All Tips

Tool of the Trade for CLI Apps - `clipboardy` 📋

This is a series of libraries and utilities for building Command-line-interfaces aka CLI using Node.js and ecosystem around it. Similar utilities/helpers may be available for other languages but, these series is focused on JavaScript and its friends.

You can check all articles under CLI Build Tool tag.

clipboardy

If you are building a CLI and need to access the system clipboard, clipboardy is the package you need. Of course, it is cross-platform and supports macOS, Windows, Linux, OpenBSD, FreeBSD, Android with Termux.

It provides APIs in both variants , async (Promise) and sync. clipboardy has a very easy to follow, simple to use API. Here is a code example:

const clipboardy = require('clipboardy');
s;
clipboardy.writeSync('something to copy to clipboard');

clipboardy.readSync(); // read from clipboard

You can check out official repo for all usage details.

Github Repo: clipboardy


Published Jul 1, 2019

Web/Product Engineer.