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

useblysh

v1.0.7

Published

High-performance visual hashing for seamless image loading. Encode images into tiny strings and decode into beautiful, fast-loading blurs.

Readme

⚡ useblysh

High-performance visual hashing for seamless image loading. Encode images into tiny strings and decode into beautiful, fast-loading blurs.

npm version License: MIT


🌟 Why useblysh?

Standard loading="lazy" leaves users staring at empty white boxes. useblysh eliminates this "broken" feel by encoding your images into tiny strings that can be sent inside your JSON API response.

  • Zero Layout Shift: Reserve image space instantly to prevent page jumping.
  • Performance: Replace 1MB images with 20-byte strings during the initial load.
  • Modern: Fully typed with TypeScript and optimized for React 18/19.

🛠️ Installation

npm install useblysh

🚀 Simple Examples

1. Generate Hash (Browser)

Generate hashes directly in the browser during an image upload.

import { encodeImage } from 'useblysh';

const handleUpload = (event) => {
  const file = event.target.files[0];
  const img = new Image();
  img.src = URL.createObjectURL(file);
  
  img.onload = () => {
    // Generate the hash from the image element
    const hash = encodeImage(img);
    console.log("Generated Hash:", hash);
    
    // Send { file, hash } to your server
  };
};

2. Display Placeholder (React)

The ImageHash component handles everything: it shows the blur immediately and fades in the real image once it's ready.

import { ImageHash } from 'useblysh'; 
 
<ImageHash 
  key={id}                  // Passing a unique key is recommended 
  hash={storedHash}        // The short string from your DB 
  src={imageUrl}          // The real high-quality image URL 
  className="w-full h-64 rounded-xl" 
/>

3. Advanced Decoding (Manual Control)

If you only want the blur placeholder without the built-in image handling, use ImageHashCanvas. Note: You'll need to manage the actual image loading and transitions yourself.

import { ImageHashCanvas } from 'useblysh'; 
import { useState } from 'react'; 

const CustomImage = ({ hash, src }) => { 
  const [loaded, setLoaded] = useState(false); 
  
  return ( 
    <div className="relative"> 
      {!loaded && ( 
        <ImageHashCanvas 
          hash={hash} 
          width={32} 
          height={32} 
          className="absolute inset-0 w-full h-full" 
        /> 
      )} 
      <img 
        src={src} 
        onLoad={() => setLoaded(true)} 
        className={`transition-opacity ${loaded ? 'opacity-100' : 'opacity-0'}`} 
      /> 
    </div> 
  ); 
}; 

💡 Use Cases

1. Progressive Image Loading

Instead of showing a spinner or a blank box, show a beautiful blurred version of the actual image. This keeps users engaged and makes the site feel faster.

2. Social Media Feeds

For infinite scroll feeds (like Instagram or Pinterest), send the useblysh string in your initial JSON request. The app can render the entire feed layout with placeholders before a single byte of actual image data is even downloaded.

3. SEO & Layout Stability (CLS)

Prevent "layout shift" where content jumps around as images load. useblysh reserves the correct aspect ratio and space immediately.


📖 How it Works

Blysh uses a Discrete Cosine Transform (DCT) to extract the most important color frequencies from an image.

  1. Encoding: The image is downsampled and converted into a set of mathematical factors, then compressed into a Base83 string.
  2. Decoding: The frontend takes that string and reconstructs a low-resolution version of the original image, applying a smooth blur filter for an elegant look.

Built with ❤️ for the modern web.