Skip to main content


deno-clippy logo

This is cross-platform Deno library for writing and reading clipboard.
You can read from/write image and text.

This library uses Rust’s arboard through FFI.
Therefore, it is basically not necessary to prepare some external commands when using this library.

However, if arboard returns an error, deno-clippy will fall back and use an external command (for example, xclip on Linux).
If arboard does not work properly and an error occurs, installing the external command may work.

Known issue.

Currently, arboard is not work on Linux.
So, please install xclip when you using library on Linux.

Support Version

deno-clippy Deno
v0.1.0 v1.24.3 or earlier
v0.2.0 v1.25.0 or later
v0.2.1 ~ v1.32.4 or later


import * as clippy from "";
import { readAll } from "";

// write image to clipboard
const f = await"testdata/out.png");
await clippy.write_image(f);

// read image from clipboard
const r = await clippy.read_image();
const data = await readAll(r);
await Deno.writeFile("example.png", data);

// write text to clipboard
await clippy.write_text("hello clippy");

// read text from clipboard
const text = await clippy.read_text();

Run script:

# You have to use `--unstable` because FFI is not stable.
deno run -A --unstable sample.ts


Any contribution including documentations are welcome.


To develop this library, the following must be installed.

  • Rust
  • Deno(v1.32.4 or later)
  • deno_bindgen
  • xclip(on Linux)
  • make

If you modify the Rust code (under src/), you need to generate bindings/bindings.ts using deno_bindgen(just run make build).
bindings.ts is the glue code to handle dylib from Deno, and basically should not be edited and committed.
bindings.ts will only be changed for new releases as follows when execute VERSION=v0.1.0 make build.

 const url = new URL(
-  "",
+  "",
 let uri = url.toString()

After implementation is complete, be sure to write tests as well.
The tests are to ensure the quality of this library.

The following is how to run the test.

# clean up dylib cache, and generate bindings.ts, dylib and run deno's test.
$ make deno-test
# run rust's tests.
$ make ffi-test
# run deno-test and ffi-test
$ make test



The logo was designed by @hashrock, licensed under CC BY-NC-ND 4.0.