Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More โ†’
Socket
Book a DemoInstallSign in
Socket

@napi-rs/clipboard

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@napi-rs/clipboard

> ๐Ÿš€ Help me to become a full-time open-source developer by [sponsoring me on Github](https://github.com/sponsors/Brooooooklyn)

Source
npmnpm
Version
1.1.1
Version published
Weekly downloads
311
103.27%
Maintainers
2
Weekly downloads
ย 
Created
Source

@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

FAQs

Package last updated on 08 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts