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

@ltcode/crosshot

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ltcode/crosshot

Cross-platform desktop screenshot utility

latest
Source
npmnpm
Version
1.1.6
Version published
Maintainers
1
Created
Source

@ltcode/crosshot

Cross-platform desktop screenshot utility for Node.js applications

npm version License: MIT

🚀 Quick Start

# Install globally
npm install -g @ltcode/crosshot

# Use CLI
crosshot --help
crosshot -n="screenshot" -f="jpg" -q=85
// Use as library
import { captureScreen } from '@ltcode/crosshot';

const result = await captureScreen({
  filename: 'my-screenshot',
  format: 'png',
  returnBase64: true  // ✨ NEW: Get base64 data
});

console.log(result.filepath);  // File saved
console.log(result.base64);    // Data URL for web use

✨ Features

  • 🖥️ Cross-platform: Linux, Windows, macOS
  • 📸 Multiple formats: PNG, JPG, WebP, BMP
  • 📦 Library & CLI: Use as package or command-line tool
  • 🎨 Base64 support: Get screenshots as base64 data URLs
  • 🎯 Smart detection: Auto-detects best screenshot tool
  • 🔧 TypeScript: Full type definitions included

📖 API Reference

captureScreen(options)

const result = await captureScreen({
  outputDir: './screenshots/',     // Output directory
  filename: 'capture',             // Filename (without extension)
  format: 'png',                   // png, jpg, webp, bmp
  quality: 100,                    // 1-100 for lossy formats
  returnBase64: false,             // Include base64 in result
  silent: true                     // Suppress console output
});

Returns:

{
  success: true,
  filename: "capture.png",
  filepath: "./screenshots/capture.png",
  size: { bytes: 1024, kb: 1.0, mb: 0.001 },
  tool: "spectacle",
  platform: "linux",
  format: "png",
  base64?: "data:image/png;base64,iVBORw0KGg...",  // if returnBase64: true
  base64Raw?: "iVBORw0KGg..."                      // if returnBase64: true
}

CLI Usage

# Basic usage
crosshot

# Custom filename and format  
crosshot -n="screenshot" -f="jpg" -q=85

# Custom output directory
crosshot -o="~/Screenshots/" -f="webp"

# Help
crosshot --help

🛠️ Supported Tools

Linux: grim, spectacle, gnome-screenshot, wayshot, scrot, maim
Windows: PowerShell (native), NirCmd
macOS: screencapture (native)

💻 Use Cases

  • Web Applications: Screenshots as base64 data URLs
  • Desktop Apps: Capture screenshots in Electron/Node.js apps
  • CI/CD: Automated screenshot generation
  • Testing: Visual regression testing
  • Documentation: Automated screenshot generation

📝 License

MIT © Lucas Tiago

Keywords

electron

FAQs

Package last updated on 18 Aug 2025

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