🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

node-clipboard-wd

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-clipboard-wd

Experimental WebDriver-based clipboard access

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

node-clipboard-wd

node-clipboard-wd is an experimental clipboard accessor that uses the Devtools protocol via puppeteer to extract data from the clipboard.

API

The Clipboard class exposes the following API:

interface Paster {
  getClipboardTypes(): Promise<string[]>;
  getClipboardRichText(): Promise<string>;
  getClipboardPlainText(): Promise<string>;
  getClipboardFile(): Promise<number[]>;
  getClipboardFormat(format: string): Promise<number[]>;
}

Under The Hood

node-clipboard-wd functions by setting up a paste listener in a Chromium instance and sending CTRL+V to trigger a paste operation.

The listener intercepts the pasted data and returns it to the Node process. This approach works surprisingly well.

Why?

The original intent was to leverage Chrome's clipboard API for both copying and pasting.

Sadly, the clipboard API is too restrictive to be effective in this context. For example, minimizing the Window that is spawned (headless mode cannot access the clipboard) will prevent all clipboard access.

What About Copying?

Copying plain text and rich text is technically possible, but there are no plans to implement it as long as full parity between copying and pasting is impossible to achieve.

Production?

While it should be reliable on all operating systems that Chromium runs on, I offer no guarantees.

This project is very experimental.

Keywords

clipboard

FAQs

Package last updated on 11 Jan 2022

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