Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
img-clipboard
Advanced tools
Readme
A cross platform Node.js utility to copy images to clipboard.
npm install --save img-clipboard
You can use the copyImg function to copy either an image Buffer
, or a file path String
.
const { copyImg } = require('img-clipboard');
copyImg(Buffer.from(imageData, 'base64'));
copyImg returns a Promise
of [err, stdout, stderr]
.
In order for this utility to work on Linux, some external dependencies are required. xclip
is required for X11 systems and wl-clipboard
is required for Wayland systems.
They can generally be installed with your distro's package manager.
# Ubuntu / Debian
sudo apt install xclip
sudo apt install wl-clipboard
# Arch / Manjaro
pacman -S xclip
pacman -S wl-clipboard
There are a couple of extra exports to help you log errors when the required packages are missing on Linux. Here's an example of how to use them:
const { copyImg, ErrorCodes, isWayland } = require('img-clipboard');
const copyToClipboard = async (imageData) => {
const [err, stdout, stderr] = await copyImg(Buffer.from(imageData, 'base64'));
if (err) {
if (err.code === ErrorCodes.COMMAND_NOT_FOUND && process.platform === 'linux')
console.err(isWayland() ? 'wl-clipboard' : 'xclip' + ' is not installed');
else console.err(stdout + stderr);
}
};
FAQs
A cross platform utility to copy images to clipboard
The npm package img-clipboard receives a total of 750 weekly downloads. As such, img-clipboard popularity was classified as not popular.
We found that img-clipboard demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.