# @jigra/clipboard

> The Clipboard API enables copy and pasting to/from the system clipboard.

Latest version **6.0.1** (published 2024-09-20) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; has provenance.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.0.1 |
| Published | 2024-09-20 |
| First published | 2022-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 57.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (Unknown) |
| Author | Family |
| Maintainers | nkduy |
| Keywords | jigra, plugin, native |

## Links

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

## Recent versions

- 6.0.1 (latest) — 2024-09-20
- 6.0.2-weekly-20241124T232317.0 (weekly) — 2024-11-24
- 6.0.0-rc.1 (next) — 2024-09-12
- 6.0.0-alpha.4 (latest-6) — 2024-09-12
- 5.0.10 (latest-5) — 2024-09-10
- 5.0.3-nightly-20230802T151652.0 (nightly) — 2023-08-02
- 6.0.2-weekly-20241117T232223.0 — 2024-11-17
- 6.0.2-weekly-20241110T232109.0 — 2024-11-10
- 6.0.2-weekly-20241103T232313.0 — 2024-11-03
- 6.0.2-weekly-20241027T232238.0 — 2024-10-27
- 6.0.2-weekly-20241020T232229.0 — 2024-10-20
- 6.0.2-weekly-20241013T232451.0 — 2024-10-13
- 6.0.2-weekly-20241006T232038.0 — 2024-10-06
- 6.0.2-weekly-20240929T232053.0 — 2024-09-29
- 6.0.2-weekly-20240922T232251.0 — 2024-09-22
- … 68 more at https://npm.io/package/@jigra/clipboard/versions

## README

# @jigra/clipboard

The Clipboard API enables copy and pasting to/from the system clipboard.

## Install

```bash
npm install @jigra/clipboard
npx jig sync
```

## Example

```typescript
import { Clipboard } from '@jigra/clipboard';

const writeToClipboard = async () => {
  await Clipboard.write({
    string: "Hello World!"
  });
};

const checkClipboard = async () => {
  const { type, value } = await Clipboard.read();

  console.log(`Got ${type} from clipboard: ${value}`);
};
```

## API

<docgen-index>

* [`write(...)`](#write)
* [`read()`](#read)
* [Interfaces](#interfaces)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### write(...)

```typescript
write(options: WriteOptions) => Promise<void>
```

Write a value to the clipboard (the "copy" action)

| Param         | Type                                                  |
| ------------- | ----------------------------------------------------- |
| **`options`** | <code><a href="#writeoptions">WriteOptions</a></code> |

**Since:** 1.0.0

--------------------


### read()

```typescript
read() => Promise<ReadResult>
```

Read a value from the clipboard (the "paste" action)

**Returns:** <code>Promise&lt;<a href="#readresult">ReadResult</a>&gt;</code>

**Since:** 1.0.0

--------------------


### Interfaces


#### WriteOptions

Represents the data to be written to the clipboard.

| Prop         | Type                | Description                                                                                                     | Since |
| ------------ | ------------------- | --------------------------------------------------------------------------------------------------------------- | ----- |
| **`string`** | <code>string</code> | Text value to copy.                                                                                             | 1.0.0 |
| **`image`**  | <code>string</code> | Image in [Data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format to copy. | 1.0.0 |
| **`url`**    | <code>string</code> | URL string to copy.                                                                                             | 1.0.0 |
| **`label`**  | <code>string</code> | User visible label to accompany the copied data (Android Only).                                                 | 1.0.0 |


#### ReadResult

Represents the data read from the clipboard.

| Prop        | Type                | Description                    | Since |
| ----------- | ------------------- | ------------------------------ | ----- |
| **`value`** | <code>string</code> | Data read from the clipboard.  | 1.0.0 |
| **`type`**  | <code>string</code> | Type of data in the clipboard. | 1.0.0 |

</docgen-api>

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