Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Brooooooklyn/Clipboard
Manipulate Clipboard in Node.js via native API.
https://github.com/Brooooooklyn/Clipboard
Last synced: 12 days ago
JSON representation
Manipulate Clipboard in Node.js via native API.
- Host: GitHub
- URL: https://github.com/Brooooooklyn/Clipboard
- Owner: Brooooooklyn
- Created: 2022-08-08T06:54:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T18:01:10.000Z (24 days ago)
- Last Synced: 2024-10-27T12:31:51.897Z (16 days ago)
- Language: Rust
- Size: 10 MB
- Stars: 79
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# `@napi-rs/clipboard`
> 🚀 Help me to become a full-time open-source developer by [sponsoring me on Github](https://github.com/sponsors/Brooooooklyn)
Manipulate Clipboard in Node.js via native API.
It's a Node.js binding for [1Password/aboard](https://github.com/1Password/arboard) with additions from [rgwood/clipboard-anywhere](https://github.com/rgwood/clipboard-anywhere)
[![install size](https://packagephobia.com/badge?p=@napi-rs/clipboard)](https://packagephobia.com/result?p=@napi-rs/clipboard)
[![Downloads](https://img.shields.io/npm/dm/@napi-rs/clipboard.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/clipboard?minimal=true)## API
### Text
```js
import { Clipboard } from '@napi-rs/clipboard'const clipboard = new Clipboard()
clipboard.setText('😅')
clipboard.getText() // '😅'
```### Image
```js
import { join } from 'path'
import { fileURLToPath } from 'url'import { Clipboard } from '@napi-rs/clipboard'
import { Transformer } from '@napi-rs/image'const image = new Transformer(
readFileSync(join(fileURLToPath(import.meta.url), '..', 'test.png'))
)
const { width, height } = await image.metadata()
const rawPixels = await image.rawPixels()
// Only accept raw RGBA pixels
clipboard.setImage(width, height, image)// You can paste image now
```