Skip to content

Node binding for rust clipboard-rs lib, powered by napi-rs.

Notifications You must be signed in to change notification settings

0x-jerry/clipboard-rs

Repository files navigation

Clipboard-RS

Node binding for rust clipboard-rs lib, powered by napi-rs.

Support read/write text/image/filePath to clipboard, cross-platform.

Usage

npm i clipboard-rs
# or
yarn i clipboard-rs
# or
pnpm i clipboard-rs

Usage

import {
  readText,
  readFiles,
  readImage,
  writeText,
  writeImage,
  writeFiles
} from 'clipboard-rs'

const text = readText() // => string | null
const imageBuffer = readImage() // => Buffer | null
const files = readFiles() // => string[] | null

// return true means write to clipboard successfully
writeText('text content') // => true | null
writeImage(buf) // => true | null
writeFiles([path]) // => true | null

Supported platforms

Please check clipboard-rs.