New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

xclip

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xclip

A crossplatform clipboard tools for copy & paste text, html and image.

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

xclip for crossplatform(mac, win, linux)

A crossplatform clipboard tools for copy & paste text, html and image.

Requirements

  • xclip command be required (Linux)
  • powershell command be required (Win32)
  • pbpaste command be required (Mac)

Install dependencies

Install dependencies with npm:

npm i xclip --save

Usage

import xclip from 'xclip'

const shell = xclip.getShell();
const cb = shell.getClipboard();
const cbtype = await cb.getContentType();

switch(cbtype) {
  case xclip.ClipboardType.Html:
    const html = await cb.getTextHtml();
    break;
  case xclip.ClipboardType.Text:
    const text = await cb.getTextPlain();
    break;
  case xclip.ClipboardType.Image:
    const currentPath = process.cwd();
    const pngfile = `${currentPath}/pasted.png`;
    await cb.getImage(pngfile);
    break;
  case xclip.ClipboardType.Unknown:
    console.log("Unknown type");
    break;
}

Keywords

typescript

FAQs

Package last updated on 22 Oct 2024

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