@napi-rs/clipboard
TypeScript icon, indicating that this package has built-in type declarations

1.1.2Β β€’Β PublicΒ β€’Β Published

@napi-rs/clipboard

πŸš€ Help me to become a full-time open-source developer by sponsoring me on Github

Manipulate Clipboard in Node.js via native API.

It's a Node.js binding for 1Password/aboard with additions from rgwood/clipboard-anywhere

install size Downloads

API

Text

import { Clipboard } from '@napi-rs/clipboard'

const clipboard = new Clipboard()

clipboard.setText('πŸ˜…')
clipboard.getText() // 'πŸ˜…'

Image

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

Readme

Keywords

none

Package Sidebar

Install

npm i @napi-rs/clipboard

Weekly Downloads

513

Version

1.1.2

License

MIT

Unpacked Size

17.4 kB

Total Files

9

Last publish

Collaborators

  • forehalo
  • broooooklyn