npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cb2f

v1.1.0

Published

Simple CLI utility to save clipboard content (text/images) to files with intuitive filename.ext syntax

Readme

 ██████╗██████╗ ██████╗ ███████╗
██╔════╝██╔══██╗╚════██╗██╔════╝
██║     ██████╔╝ █████╔╝█████╗  
██║     ██╔══██╗██╔═══╝ ██╔══╝  
╚██████╗██████╔╝███████╗██║     
 ╚═════╝╚═════╝ ╚══════╝╚═╝     

Clipboard to File (cb2f)

Simple CLI utility to save clipboard content (text/images) to files with intuitive syntax.

Tested on macOS Ventura, Monterey, Big Sur

Quick Start

# Install globally
npm install -g cb2f

# Save clipboard as specific filename
cb2f screenshot.png
cb2f notes.txt
cb2f config.json

# Take a screenshot (Cmd+Shift+Ctrl+4 on macOS), then:
cb2f bug-report.png

Installation

Option 1: npm (Recommended)

npm install -g cb2f

Option 2: Development Setup

git clone [email protected]:obbaeiei/clipboard-2-file.git
cd clipboard-2-file
npm install
npm link

Usage

Simple Syntax (New!)

# Most common usage - specify filename with extension
cb2f filename.ext

# Examples:
cb2f screenshot.png    # Save clipboard image as screenshot.png
cb2f notes.txt         # Save clipboard text as notes.txt
cb2f bug-report.jpg    # Save clipboard image as bug-report.jpg
cb2f config.json       # Save clipboard as config.json

Legacy Syntax (Still Supported)

cb2f <format> [output-path] [options]

# Examples:
cb2f png                        # Auto-generated timestamp filename
cb2f txt ~/Documents           # Save to specific directory
cb2f png . --name my-image     # Custom name with extension added

Perfect for Screenshots

On macOS, use Cmd+Shift+Ctrl+4 to copy screenshot to clipboard, then:

cb2f screenshot.png
cb2f bug-report.jpg
cb2f design-mockup.png

Common Use Cases

# Screenshots and images
cb2f screenshot.png
cb2f bug-report.jpg
cb2f diagram.png
cb2f meme.gif

# Code and text
cb2f notes.txt
cb2f config.json
cb2f snippet.js
cb2f data.csv

# Quick saves with timestamps (legacy)
cb2f png                    # → clipboard-2024-12-05T14-30-45-123Z.png
cb2f txt                    # → clipboard-2024-12-05T14-30-45-456Z.txt

Supported Formats

  • Text: txt, md, json, js, ts, html, css, xml
  • Images: png, jpg, jpeg, gif, webp, bmp

Features

  • Intuitive syntax: Just specify filename.ext
  • Auto-format detection: Reads extension to determine format
  • Screenshot ready: Perfect for Cmd+Shift+Ctrl+4 screenshots
  • Cross-platform clipboard: Works with text and images
  • Auto-generated names: Fallback to timestamped filenames
  • Error handling: Clear messages for troubleshooting

Requirements

  • Node.js: 14.0.0 or higher
  • OS: macOS (uses native AppleScript for reliable image clipboard access)
  • Permissions: Grant Terminal clipboard access when prompted

Publishing to npm

# Update version and publish
npm version patch
npm publish

Permissions Setup

Required Permission for Images

When you first run cb2f with an image, you'll see this popup:

"Terminal" wants access to control "System Events". Allowing control will provide access to documents and data in "System Events", and to perform actions within that app.

Click "OK" to allow this. This enables AppleScript to read clipboard images.

Where to manage permissions:

  • System SettingsPrivacy & SecurityAutomationTerminal → ✅ System Events
  • System PreferencesSecurity & PrivacyPrivacyAutomationTerminal → ✅ System Events

Quick access:

open "x-apple.systempreferences:com.apple.preference.security?Privacy_Automation"

Troubleshooting

Clipboard Access Issues

  • Grant Automation permission (see above) for image clipboard access
  • Text clipboard works without special permissions
  • Try copying content again before running command

Image Not Saving

  • Use Cmd+Shift+Ctrl+4 (not Cmd+Shift+4) to copy screenshot to clipboard
  • Verify image is in clipboard with: osascript -e "clipboard info"
  • Check Automation permission is enabled for Terminal → System Events

Permission Denied Errors

  • Enable Automation permission: TerminalSystem Events
  • Restart Terminal after granting permission