# @mariozechner/clipboard

> > **Fork of [@crosscopy/clipboard](https://github.com/CrossCopy/clipboard)** > > This fork updates to the latest `clipboard-rs` (0.3.1) and adds musl (Alpine Linux) support. > All credit goes to the original authors.

Latest version **0.3.9** (published 2026-05-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @mariozechner/clipboard
pnpm add @mariozechner/clipboard
yarn add @mariozechner/clipboard
bun add @mariozechner/clipboard
```

## Health

**Score 60/100 (C)** — status: active.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.3.9 |
| Published | 2026-05-28 |
| First published | 2026-01-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 10 |
| Dependencies | 0 |
| Unpacked size | 139.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 23 |
| Maintainers | badlogic, mitsuhiko |

## Links

- npm: https://www.npmjs.com/package/@mariozechner/clipboard
- Repository: https://github.com/badlogic/clipboard
- Homepage: https://github.com/badlogic/clipboard#readme
- Issues: https://github.com/badlogic/clipboard/issues
- npm.io page: https://npm.io/package/@mariozechner/clipboard

## Recent versions

- 0.3.9 (latest) — 2026-05-28
- 0.3.6 — 2026-05-16
- 0.3.5 — 2026-04-29
- 0.3.3 — 2026-04-24
- 0.3.2 — 2026-02-01
- 0.3.0 — 2026-01-08

## README

# @mariozechner/clipboard

> **Fork of [@crosscopy/clipboard](https://github.com/CrossCopy/clipboard)**
>
> This fork updates to the latest `clipboard-rs` (0.3.1) and adds musl (Alpine Linux) support.
> All credit goes to the original authors.

![NPM Version](https://img.shields.io/npm/v/@mariozechner/clipboard)
[![CI](https://github.com/badlogic/clipboard/actions/workflows/CI.yml/badge.svg)](https://github.com/badlogic/clipboard/actions/workflows/CI.yml)

**NPM Package**: https://www.npmjs.com/package/@mariozechner/clipboard

**GitHub**: https://github.com/badlogic/clipboard

> This is a clipboard API npm package that allows you to copy and paste data to and from the clipboard.
> There doesn't seem to be a good clipboard package for node.js (that supports data format beyond text), so I decided to make one.
> Data Format Supported
>
> - Text
> - Image
> - Rich Text Format
> - Files
> - HTML

## Acknowledgements

- [ChurchTao/clipboard-rs](https://github.com/ChurchTao/clipboard-rs) is written in rust, which is used to provide the native clipboard support for this package across Linux, Windows and MacOS. This package is basically a wrapper around this rust package.
  - https://crates.io/crates/clipboard-rs
- [napi.rs](https://napi.rs/) was used to create the node.js addon for this package, so that API calls written in rust can be called from node.js.

## API

Detailed API function declarations can be found in the [index.d.ts](./index.d.ts).

Or you can refer to the source code in [src/lib.rs](./src/lib.rs).

## Sample

```javascript
import Clipboard from "@mariozechner/clipboard";

console.log(await Clipboard.getText());

console.log(await Clipboard.getHtml());

if (await Clipboard.hasImage()) {
  console.log(await Clipboard.getImageBase64());
} else {
  console.log("No Image");
}
```

## Publish

Everything is done with GitHub Action.

Run `npm version patch` to bump the version.
Then `git push --follow-tags` to push the changes and tags to GitHub. GitHub Action will automatically build and publish.

The GitHub Actions `NPM_TOKEN` repository secret is a granular npm token with publish access to `@mariozechner/clipboard` and all `@mariozechner/clipboard-*` platform packages. npm granular access tokens expire after 90 days, so this secret must be rotated before expiry.

---
_Source: https://npm.io/package/@mariozechner/clipboard · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
