Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/crosscopy/clipboard

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/crosscopy/clipboard

  • v0.2.6
  • Source
  • Go
  • Socket score

Version published
Created
Source

Clipboard

NPM Package: https://www.npmjs.com/package/@crosscopy/clipboard

GitHub: https://github.com/crosscopy/clipboard

This is a clipboard API npm package that allows you to copy and paste data to and from the clipboard. There doesn't seem to be a good clipboard package for node.js (that supports data format beyond text), so I decided to make one. Data Format Supported

  • Text
  • Image
  • Rich Text Format
  • Files
  • HTML

Acknowledgements

  • ChurchTao/clipboard-rs is written in rust, which is used to provide the native clipboard support for this package across Linux, Windows and MacOS. This package is basically a wrapper around this rust package.
  • napi.rs was used to create the node.js addon for this package, so that API calls written in rust can be called from node.js.

API

Detailed API function declarations can be found in the index.d.ts.

Or you can refer to the source code in src/lib.rs.

Sample

import Clipboard from "@crosscopy/clipboard";

console.log(await Clipboard.getText());

console.log(await Clipboard.getHtml());

if (await Clipboard.hasImage()) {
  console.log(await Clipboard.getImageBase64());
} else {
  console.log("No Image");
}

Plan

A clipboard listener will be added soon for monitoring clipboard changes and get notified when the clipboard content changes.

Publish

Everything is done with GitHub Action.

Run npm version patch to bump the version. Then git push --follow-tags to push the changes and tags to GitHub. GitHub Action will automatically build and publish.

FAQs

Package last updated on 12 Apr 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc